-
Notifications
You must be signed in to change notification settings - Fork 122
/
Gruntfile.js
243 lines (227 loc) · 6.03 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('./package.json'),
clean: {
options: {
force: true
},
all: ['./dist/', './www/']
},
fileExists: {
css: ['./dist/css/winstrap.min.css']
},
sass: {
options: {
outputStyle: 'nested',
sourceMap: true,
precision: 5,
includePaths: [
"node_modules"
]
},
dist: {
files: {
'./dist/css/winstrap.css': './src/scss/winstrap.scss',
'./dist/css/winstrap-optional.css': './src/scss/winstrap-optional.scss'
}
}
},
// Minify CSS
cssmin: {
target: {
files: [{
expand: true,
cwd: './dist/css',
src: ['*.css', '!*.min.css'],
dest: './dist/css/',
ext: '.min.css'
}]
}
},
// Copy files
copy: {
// Copy distribution assets from src folder to dist
dist:{
files:[
{
expand: true,
cwd: './src/fonts/',
src: '**',
dest: './dist/fonts/'
},
{
expand: true,
cwd: './src/images/',
src: '*',
dest: './dist/images/'
},
// Copy vendor js to dist and www
{
expand: true,
cwd: 'node_modules/jquery/dist/',
src: ['jquery.min.js', 'jquery.min.map'],
dest: 'dist/js/vendor/'
},
{
expand: true,
cwd: 'node_modules/bootstrap-sass/assets/javascripts/',
src: 'bootstrap.min.js',
dest: 'dist/js/vendor/'
},
{
expand: true,
cwd: 'dist/js/vendor',
src: ['jquery.min.js', 'jquery.min.map'],
dest: 'www/js/vendor/'
},
{
expand: true,
cwd: 'dist/js/vendor',
src: 'bootstrap.min.js',
dest: 'www/js/vendor/'
},
{
expand: true,
cwd: './src/fonts/',
src: '**',
dest: './www/fonts/'
},
{
expand: true,
cwd: './src/images/',
src: '*',
dest: './www/images/'
}
]
},
// Copy css and js from dist to www
doc: {
files: [
{
expand: true,
cwd: './dist/css',
src: ['*.min.css', '*.min.css.map'],
dest: './www/css/'
},
{
expand: true,
cwd: './src/js/',
src: '*.js',
dest: './www/js/'
},
{
expand: true,
cwd: './dist/js/vendor/',
src: ['*.js', '*.map'],
dest: './www/js/vendor/'
}
]
}
},
// Build the main HTML files of the style guide
assemble: {
options: {
partials: ['./src/doc/partials/**/*.hbs'],
layout: ['./src/doc/layouts/default.hbs'],
helpers: ['./handlebars-helpers/*.js'],
flatten: true,
data: './src/doc/data/*.json',
// Set the version number
version: '<%= pkg.version %>',
// Name of the project
name: '<%= pkg.name %>',
},
pages: {
src: ['./src/doc/*.hbs'],
dest: './www/'
}
},
// Watch javascript and css files of the style guide
watch: {
sass: {
files: './src/scss/**/*.scss',
tasks: ['sass']
},
cssmin: {
files: ['./dist/css/**.css', '!./dist/css/**.min.css'],
tasks: ['cssmin', 'copy:doc']
},
doc: {
files: ['./src/doc/**/*', './src/js/*.js'],
tasks: ['jshint', 'assemble', 'copy:doc']
},
configFiles: {
files: ['gruntfile.js'],
options: {
reload: true
}
},
options: {
livereload: true,
tasks: ['notify:assemble']
}
},
connect: {
server: {
options: {
port: 9001,
base: ['./', './www/'],
hostname: 'localhost',
livereload: true,
open: true
}
}
},
bump: {
options: {
files: ['./package.json'],
commit: true,
commitMessage: 'Release version %VERSION%',
commitFiles: ['package.json'],
updateConfigs: ['pkg'],
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
},
notify: {
server: {
options: {
title: 'Winstrap',
message: 'Server started'
},
},
watch: {
options: {
title: 'Winstrap',
message: 'assemble completed', //required
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish')
},
all: ['./gruntfile.js', './src/js/**/*']
}
});
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-file-exists');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', ['clean', 'sass', 'cssmin', 'assemble', 'copy', 'fileExists', 'jshint']);
grunt.registerTask('server', ['connect', 'notify:server', 'watch']);
};