-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathGruntfile.js
executable file
·164 lines (146 loc) · 3.25 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
module.exports = function(grunt) {
require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
pkg: pkg,
shell: {
},
sass: {
options: {
outputStyle: 'nested',
imagePath: 'assets/images',
precision: 5,
includePaths: [
'components'
]
},
dev: {
files: {
'public/css/screen.css': 'assets/sass/config.imports.scss'
}
}
},
pixrem: {
dist: {
options: {
replace: false
},
src: 'public/css/screen.css',
dest: 'public/css/screen.css'
}
},
uglify: {
dev: {
options: {
beautify: true,
mangle: false,
compress: false
},
files: {
'public/js/script.min.js': [
// Include:
'components/jquery/dist/jquery.js',
'assets/js/modules/*.js',
'assets/js/script.js'
],
'public/js/modernizr.min.js': 'assets/js/modernizr.min.js'
}
}
},
imagemin: { // Task
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'assets/images/', // cwd is 'current working directory' - Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'public/images/' // Destination path prefix
}]
}
},
copyFiles: '**/*.{eot,svg,ttf,woff,pdf}',
copy: {
target: {
files: [
// includes files within path
{
expand: true,
cwd: 'assets/',
src: ['<%= copyFiles %>'],
dest: 'public/',
filter: 'isFile'
}
]
}
},
// Will Automatically insert the correct prefixes for CSS properties. Just write plain CSS.
autoprefixer: {
options: {
browsers: ['last 2 version', 'ie 9']
},
prod: {
src: 'public/**/*.css'
},
dev: {
src: 'public/**/*.css'
},
},
// Watch options: what tasks to run when changes to files are saved
watch: {
options: {},
css: {
files: ['assets/sass/**/*.scss'],
tasks: ['css'] // Compile with Compass when Sass changes are saved
},
js: {
files: ['assets/js/**/*.js'], // Watch for changes in JS files
tasks: ['javascript']
},
// html: {
// options: {
// spawn: false
// }
// },
images: {
files: ['assets/**/*.{png,jpg,gif}'],
tasks: ['images']
},
copy: {
files: ['assets/<%= copyFiles %>'],
tasks: ['copy']
}
}
});
/**
* CSS tasks
*/
grunt.registerTask('css', [
'sass',
'autoprefixer:dev',
'pixrem'
]);
/**
* JavaScript tasks
*/
grunt.registerTask('javascript', [
'uglify:dev'
]);
/**
* Images tasks
*/
grunt.registerTask('images', [
'imagemin'
]);
/**
* Dev task
*/
grunt.registerTask('dev', [
'css',
'javascript',
'images',
'copy'
]);
/**
* Default Tasks
*/
grunt.registerTask('default', ['dev', 'watch']);
};