-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgruntfile.js
142 lines (119 loc) · 3.39 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
watch : {
images : {
files : ['images/src/*.{png,jpg,gif}'],
tasks : ['newer:imagemin']
}, // watch images added to src
deleting : {
files : ['images/src/*.{png,jpg,gif}'],
tasks : ['delete_sync']
}, // end of delete sync
scripts : {
files : ['js/libs/*.js', 'js/custom/*.js'],
tasks : ['concat', 'uglify'],
options : {
spawn : false,
}
}, //end of watch scripts
css : {
files : ['sass/**/*.scss','!.sass-cache'],
tasks : ['sass', 'autoprefixer'],
options : {
spawn : false,
}
}, //end of sass watch
}, //end of watch
/* ====================================================================================================================================================
* ====================================================================================================================================================
Tasks
====================================================================================================================================================
====================================================================================================================================================
*/
delete_sync : {
dist : {
cwd : 'images/dist',
src : ['**'],
syncWith : 'images/src'
}
}, // end of delete sync
imagemin : {
dynamic : {
files : [{
expand : true, // Enable dynamic expansion
cwd : 'images/src/', // source images (not compressed)
src : ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest : 'images/dist/' // Destination of compressed files
}]
}
}, //end imagemin
concat : {
dist : {
src : ['js/libs/*.js', 'js/custom/*.js'],
dest : 'js/build/production.js'
}
}, //end concat
uglify : {
dist : {
src : 'js/build/production.js',
dest : 'js/build/production.min.js'
}
}, //end uglify
sass : {
dist : {
options : {
style : 'nested', //no need for config.rb
compass : 'true',
require : 'sassy-buttons'
},
files : {
'css/main.css' : 'sass/main.scss'
}
}
}, //end of sass
autoprefixer : {
options : {
browsers : ['> 5%', 'last 2 version', 'ie 8', 'ie 9']
},
dist : {
files : {
'css/main.css' : 'css/main.css'
}
}
}, //end of autoprefixer
penthouse : {
extract : {
outfile : 'css/critical.css.php',
css : 'css/main.css',
url : 'http://localhost/drunk-ux',
width : 1200,
height : 500
},
}, //end of penthouse
browserSync : {
dev : {
bsFiles : {
src : ['css/*.css', 'images/*.*', 'js/build/production.min.js', '*.php', 'includes/*.php']
},
options : {
proxy : "localhost/drunk-ux",
watchTask : true // < VERY important
}
}
}
});
// load npm tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-delete-sync');
grunt.loadNpmTasks('grunt-penthouse');
// define default task
grunt.registerTask('default', ["browserSync", "watch"]);
};