-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
120 lines (119 loc) · 2.85 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
module.exports = function (grunt) {
require('jit-grunt')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// add vendor prefixes to stylesheets
autoprefixer: {
development: {
options: {
browsers: ['> 1%', 'last 2 versions', 'Opera 12.1', 'Firefox ESR', 'ie >= 9'],
map: true
},
files: [{
expand: true, // Enable dynamic expansion
flatten: true, // Remove all path parts from generated dest paths.
src: ['css/*.css'], // Actual pattern(s) to match.
dest: 'css/' // Destination path prefix.
}],
}
},
imagemin: {
options: {
optimizationLevel: 3,
progressive: true,
interlaced: true
},
development: {
files: ['**/*.{png,jpg,gif,jpeg}']
}
},
sass: {
development: {
options: {
sourcemap: 'inline',
trace: true,
style: 'expanded',
debugInfo: false,
lineNumbers: true,
},
files: {
'css/style.css' : 'scss/style.scss'
}
},
production: {
options: {
sourcemap: 'none',
trace: false,
style: 'compressed',
noCache: true,
},
files: {
'css/style.css' : 'scss/style.scss'
}
}
},
watch: {
sass: {
files: ['scss/*.scss', 'scss/**/*.scss'],
tasks: ['sass:development', 'autoprefixer'],
options: {
livereload: true
}
},
html: {
files: ['*.html'],
options: {
livereload: true
}
},
js: {
files: ['*.js', '**/*.js', '!js/site.min.js'],
tasks: ['uglify:development'],
options: {
livereload: true
}
}
},
uglify: {
development: {
options: {
preserveComments: 'all',
beautify: true,
mangle: {
except: ['jQuery']
}
},
files: {
'js/site.min.js': ['js/*.js','!js/site.min.js']
}
},
production: {
options: {
compress: {
drop_console: true
},
preserveComments: false,
mangle: {
except: ['jQuery']
}
},
files: {
'js/site.min.js': ['js/*.js','!js/site.min.js']
}
}
},
connect: {
development: {
options: {
base: '.',
port: '8000',
livereload: true
}
}
}
});
grunt.registerTask('default', ['uglify:development', 'sass:development', 'connect', 'watch']);
grunt.registerTask('dev', ['uglify:development','sass:development', 'autoprefixer']);
grunt.registerTask('production', ['uglify:production','sass:production', 'autoprefixer']);
};