forked from Syonet/bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
153 lines (146 loc) · 3.36 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
/*jshint node:true*/
module.exports = function( grunt ) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON( "package.json" ),
watch: {
main: {
files: [
"styles/*.less",
"scripts/**/*.js"
],
tasks: [
"clean:main",
"less:main",
"jshint:main",
"process"
]
},
docs: {
files: [
"docs/**/*.less",
"docs/**/*.hbs",
"docs/**/*.js"
],
tasks: [
"clean:docs",
"less:docs",
"jshint:docs",
"hogan"
]
}
},
clean: {
main: "dist/",
docs: "*.html"
},
less: {
main: {
files: {
"dist/bootstrap.css": [
"styles/vendor/normalize.css",
"styles/bootstrap.less"
],
"dist/jquery.ui.css": [
// Junta TODOS os arquivos do jQuery UI, na sua ordem certa.
// @TODO usar apenas o core + glob *.css. Será que vai excluir o core deste glob pra ficar na
// ordem certa?
"styles/vendor/jquery-ui/*core.css",
"styles/vendor/jquery-ui/*accordion.css",
"styles/vendor/jquery-ui/*autocomplete.css",
"styles/vendor/jquery-ui/*button.css",
"styles/vendor/jquery-ui/*datepicker.css",
"styles/vendor/jquery-ui/*dialog.css",
"styles/vendor/jquery-ui/*menu.css",
"styles/vendor/jquery-ui/*progressbar.css",
"styles/vendor/jquery-ui/*resizable.css",
"styles/vendor/jquery-ui/*selectable.css",
"styles/vendor/jquery-ui/*slider.css",
"styles/vendor/jquery-ui/*spinner.css",
"styles/vendor/jquery-ui/*tabs.css",
"styles/vendor/jquery-ui/*tooltip.css",
"styles/jquery.ui.less"
]
}
},
docs: {
files: {
"docs/compiled/main.css": "docs/main.less"
}
}
},
hogan: {
docs: {
layout: "docs/templates/layout.hbs",
src: [
"docs/templates/pages/*.hbs"
],
dest: "."
}
},
process: {
all: {
src: [
"images/*",
// Copia apenas as fontes utilizadas em produção
"fonts/SyoBootstrap.eot",
"fonts/SyoBootstrap.svg",
"fonts/SyoBootstrap.ttf",
"fonts/SyoBootstrap.woff",
// Processa novamente os arquivos JS/CSS para a inclusão do banner
"dist/*.css",
"dist/*.js"
],
strip: /^dist/,
dest: "dist"
}
},
qunit: {
files: [
"scripts/tests/index.html"
]
},
jshint: {
options: {
jshintrc: ".jshintrc"
},
main: "scripts/**/*.js",
docs: "docs/main.js"
},
concat: {
main: {
src: "scripts/*.js",
dest: "dist/bootstrap.js"
}
},
connect: {
main: {
options: {
hostname: "*",
keepalive: true,
port: 8001
}
}
}
});
// NPM
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-concat");
// Local
grunt.loadTasks("build");
// Processo principal de build
grunt.registerTask( "default", [
"clean", // Limpa todo o diretório dist
"less", // Compila os arquivos LESS
"jshint", // Faz o linting em todos os arquivos JS relevantes
"concat", // Concatena os arquivos javascript em um só
"process", // Copia e inclui o banner nos arquivos de distribuição
"hogan", // Compila a documentação do projeto
"qunit" // Roda os testes JS
]);
};