-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
141 lines (137 loc) · 3.17 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
/*! Copyright (c) 2014 Sameera Thilakasiri (http://www.sameerast.com)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 1
*
*/
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
options: {
compress: false,
yuicompress: false,
optimization: 2
},
files: {
// "target.css file": "source.less file"
}
}
},
watch: {
styles: {
// Which files to watch (all .less files recursively in the less directory)
files: ['./*.less'],
tasks: ['less'],
options: {
nospawn: true
}
}
},
jshint: {
src: ['path/to/javascripts.js'],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true,
globals: {
require: true,
define: true,
requirejs: true,
describe: true,
expect: true,
it: true
}
}
},
csslint: {
strict: {
src: ['*.css']
},
lax: {
options: {
csslintrc: '.csslintrc'
},
src: ['*.css']
}
},
concat: {
options: {
separator: ';',
},
dist: {
src: ['path/to/javascript.js'],
dest: 'dist/built.js',
},
},
concat_css: {
options: {
// Task-specific options go here.
},
all: {
src: ["*.css"],
dest: "styles.css"
},
},
cssmin: {
combine: {
files: {
'output.css': ['styles.css']
}
}
},
uglify: {
options: {
mangle: false
},
my_target: {
files: {
'dest/output.min.js': ['dist/built.js']
}
}
},
imagemin: {
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'assets/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'dist/' // Destination path prefix
}]
}
}
});
// Load less task
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
// Load CSSLint task
grunt.loadNpmTasks('grunt-contrib-csslint');
// Load JSHint task
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load JS concat task
grunt.loadNpmTasks('grunt-contrib-concat');
// Load CSS concat task
grunt.loadNpmTasks('grunt-concat-css');
// Load CSS minify task
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Load JS minify task
grunt.loadNpmTasks('grunt-contrib-uglify');
// Load image optimize task
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('default', ['csslint:lax']);
grunt.registerTask('default', 'jshint');
grunt.registerTask('default', 'concat');
grunt.registerTask('default', 'concat_css');
grunt.registerTask('default', 'cssmin');
grunt.registerTask('default', 'uglify');
grunt.registerTask('default', 'imagemin');
grunt.registerTask('default', ['watch']);
};