-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
174 lines (166 loc) · 5.63 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
165
166
167
168
169
170
171
172
173
174
module.exports = function(grunt) {
require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
style: ['css', 'styleguide', 'build/css'],
javascript: ['build/js']
},
copy: {
styleguide: {
files: [
{ src: ['sass/styleguide.md'], dest: 'build/css/styleguide/styleguide.md'}
]
}
},
compass: {
dist: {
options: {
config: 'config.rb'
}
},
style: {
options: {
sassDir: 'sass',
specify: 'sass/screen.scss',
cssDir: 'build/css/styleguide',
environment: 'development',
outputStyle: 'compact',
noLineComments: true,
debugInfo: false,
quiet: false
}
}
},
cssc: {
build: {
options: {
sortSelectors: true,
consolidateViaDeclarations: true,
consolidateViaSelectors: true,
consolidateMediaQueries: true
},
files: {
'css/screen.css': 'css/screen.css'
}
}
},
cssmin: {
build: {
src: 'css/screen.css',
dest: 'css/screen.min.css'
}
},
watch: {
options: {
livereload: true,
},
coffee: {
files: ['coffee/*'],
tasks: ['buildjs']
},
sass: {
files: ['sass/**/*.scss'],
tasks: ['compass', 'cssc', 'cssmin', 'buildstyle']
},
css: {
files: ['css/*.css', 'build/**/*.css']
},
template: {
files: ['lib/styleguide-template/**/*'],
tasks: ['shell']
},
html: {
files: ['index.html'],
tasks: ['htmlhint']
},
js: {
files: ['assets/js/base.js'],
tasks: ['coffee', 'uglify']
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
}
},
shell: {
styleguide: {
command: 'kss-node build/css/styleguide styleguide --css build/css/styleguide/screen.css --template lib/styleguide-template'
}
},
htmlhint: {
build: {
options: {
'tag-pair': true,
// Force tags to have a closing pair
'tagname-lowercase': true,
// Force tags to be lowercase
'attr-lowercase': true,
// Force attribute names to be lowercase e.g. <div id="header"> is invalid
'attr-value-double-quotes': true,
// Force attributes to have double quotes rather than single
'doctype-first': true,
// Force the DOCTYPE declaration to come first in the document
'spec-char-escape': true,
// Force special characters to be escaped
'id-unique': true,
// Prevent using the same ID multiple times in a document
'head-script-disabled': true,
// Prevent script tags being loaded in the for performance reasons
'style-disabled': true
// Prevent style tags. CSS should be loaded through
},
src: ['index.html']
}
},
coffee: {
compile: {
files: {
'build/js/base.js': 'coffee/*.coffee'
}
},
},
concat: {
options: {
// define a string to put between each file in the concatenated output
separator: ';'
},
dist: {
// the files to concatenate
src: ['build/js/*.js', 'plugins/*.js'],
// the location of the resulting JS file
dest: 'build/js/build.js'
}
},
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
files: {
'js/build.min.js': ['<%= concat.dist.dest %>']
}
}
},
jshint: {
// define the files to lint
files: ['gruntfile.js', 'build/js/*.js'],
// configure JSHint (documented at http://www.jshint.com/docs/)
options: {
// more options here if you want to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true
}
}
}
});
grunt.registerTask('default', []);
grunt.registerTask('build', ['buildcss', 'buildstyle', 'buildjs']);
grunt.registerTask('buildjs', ['clean:javascript', 'coffee', 'jshint', 'concat', 'uglify']);
grunt.registerTask('buildcss', ['clean:style', 'compass', 'cssc', 'cssmin']);
grunt.registerTask('buildstyle', ['copy', 'shell']);
};