-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
97 lines (86 loc) · 3.48 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
js: {
// 2. Configuration for concatinating files goes here.
dist: {
src: [
'assets/js/libs/*.js', // All JS in the libs folder
'assets/js/global.js' // This specific file
],
dest: 'assets/js/build/production.js',
},
},
css: {
// dist: {
src: [
'assets/styles/boilerplate/stylesheets/base.css', // Boilerplate CSS
'assets/styles/boilerplate/stylesheets/skeleton.css', // Boilerplate CSS
'assets/styles/boilerplate/stylesheets/layout.css' // Boilerplate CSS
],
dest: 'assets/styles/build/boilerplate.css',
},
// },
},
uglify: {
build: {
src: 'assets/js/build/production.js',
dest: 'assets/js/build/production.min.js',
},
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'images/',
src: ['**/*.{png,jpg,gif}'],
dest: 'img/build/'
}]
},
},
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'assets/styles/build/global.css': 'assets/styles/sass/mainstyles.scss'
},
},
},
cssmin: {
css:{
src: [/*'assets/styles/build/boilerplate.css',*/'assets/styles/build/global.css', 'assets/styles/vendor/*.css'],
dest: 'assets/styles/build/global.min.css'
},
},
watch: {
scripts: {
files: ['assets/js/*.js', 'assets/styles/vendor/*.css', 'assets/styles/*.css', 'assets/styles/sass/*.scss' ],
tasks: ['concat', 'sass', 'cssmin', 'uglify'],
options: {
spawn: true,//edited from false due to (FSEvents.framework) FSEventStreamFlushSync(): failed assertion '(SInt64)last_id > 0LL' error
},
},
},
fontAwesomeVars: {
main: {
variablesSassPath: 'assets/styles/sass/_variables.scss',
fontPath: '../assets/styles/fonts/font-awesome' //NOTE: this must be relative to FINAL, compiled .css file - NOT the variables.less file! For example, this would be the correct path if the compiled css file is main.css which is in 'src/build' and the font awesome font is in 'src/bower_components/font-awesome/fonts' - since to get from main.css to the fonts directory, you first go back a directory then go into bower_components > font-awesome > fonts.
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
// grunt.loadNpmTasks('grunt-font-awesome-vars');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['concat', 'uglify', 'imagemin', 'sass', 'cssmin', /*'fontAwesomeVars',*/ 'watch']);
};