-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
81 lines (75 loc) · 1.86 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
'use strict';
module.exports = function ( grunt ) {
// load all grunt tasks matching the `grunt-*` pattern
// Ref. https://npmjs.org/package/load-grunt-tasks
require( 'load-grunt-tasks' )( grunt );
grunt.initConfig( {
sass: {
scss: {
files: [ {
style: 'compressed',
expand: true,
flatten: true,
cwd: 'assets/',
src: ['*.scss'],
dest: '',
ext: '.css'
} ]
}
},
// Image Optimization
// Note: This is one time running task, so run grunt after adding images in img/ folder
// Ref. https://npmjs.org/package/grunt-contrib-imagemin
imagemin: {
dynamic: {
options: {
optimizationLevel : 7,
progressive : true
},
files: [ {
expand : true,
cwd : 'assets/img/',
src : [ '**/*.{png,jpg,gif}' ],
dest : 'assets/img/'
} ]
}
},
// Uglify
// Compress and Minify JS files in js/main.js
// Ref. https://npmjs.org/package/grunt-contrib-uglify
uglify: {
dist: {
files: {
'assets/main.min.js': [ 'assets/js/*.js' ]
}
}
},
// autoprefixer
autoprefixer: {
options: {
browsers : [ 'last 2 versions', 'ie 9', 'ios 5', 'android 4' ],
map : false
},
files: {
expand : true,
flatten : true,
src : '*.css',
dest : ''
}
},
// Watch for hanges and trigger compass, jshint, uglify and livereload
// Ref. https://npmjs.org/package/grunt-contrib-watch
watch: {
sass: {
files: [ '**/*.{scss,sass}' ],
tasks: [ 'sass', 'autoprefixer' ]
},
uglify: {
files: [ 'assets/js/*.js' ],
tasks: [ 'uglify' ]
}
},
} );
// Register Task
grunt.registerTask( 'default', [ 'imagemin', 'watch' ] );
};