-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·157 lines (149 loc) · 4.56 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
stripBanners: true,
banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
},
patternlab: {
src: './builder/patternlab.js',
dest: './builder/patternlab.js'
},
object_factory: {
src: './builder/object_factory.js',
dest: './builder/object_factory.js'
},
lineage: {
src: './builder/lineage_hunter.js',
dest: './builder/lineage_hunter.js'
},
media_hunter: {
src: './builder/media_hunter.js',
dest: './builder/media_hunter.js'
},
patternlab_grunt: {
src: './builder/patternlab_grunt.js',
dest: './builder/patternlab_grunt.js'
},
patternlab_gulp: {
src: './builder/patternlab_gulp.js',
dest: './builder/patternlab_gulp.js'
},
parameter_hunter: {
src: './builder/parameter_hunter.js',
dest: './builder/parameter_hunter.js'
},
pattern_exporter: {
src: './builder/pattern_exporter.js',
dest: './builder/pattern_exporter.js'
},
pattern_assembler: {
src: './builder/pattern_assembler.js',
dest: './builder/pattern_assembler.js'
},
pseudopattern_hunter: {
src: './builder/pseudopattern_hunter.js',
dest: './builder/pseudopattern_hunter.js'
},
list_item_hunter: {
src: './builder/list_item_hunter.js',
dest: './builder/list_item_hunter.js'
},
style_modifier_hunter: {
src: './builder/style_modifier_hunter.js',
dest: './builder/style_modifier_hunter.js'
}
},
copy: {
main: {
files: [
{ expand: true, cwd: './source/js/', src: '*', dest: './public/js/'},
{ expand: true, cwd: './source/css/', src: '*.css', dest: './public/css/' },
{ expand: true, cwd: './source/images/', src: ['*.png', '*.jpg', '*.gif', '*.jpeg'], dest: './public/images/' },
{ expand: true, cwd: './source/images/sample/', src: ['*.png', '*.jpg', '*.gif', '*.jpeg'], dest: './public/images/sample/'},
{ expand: true, cwd: './source/fonts/', src: '*', dest: './public/fonts/'},
{ expand: true, cwd: './source/_data/', src: 'annotations.js', dest: './public/data/' }
]
},
css: {
files: [
{ expand: true, cwd: './source/css/', src: '*.css', dest: './public/css/' }
]
}
},
watch: {
all: {
files: [
'source/css/**/*.css',
'public/styleguide/css/*.css',
'source/_patterns/**/*.mustache',
'source/_patterns/**/*.json',
'source/_data/*.json'
],
tasks: ['default']
},
scss: {
files: ['source/css/**/*.scss', 'public/styleguide/css/*.scss'],
tasks: ['sass', 'copy:css','bsReload:css']
},
patterns: {
files: [
'source/_patterns/**/*.mustache',
'source/_patterns/**/*.json',
'source/_data/*.json'
],
tasks: ['default']
}
},
sass: {
build: {
options: {
style: 'expanded',
precision: 8
},
files: {
'./source/css/style.css': './source/css/style.scss',
'./public/styleguide/css/static.css': './public/styleguide/css/static.scss',
'./public/styleguide/css/styleguide.css': './public/styleguide/css/styleguide.scss',
'./public/styleguide/css/styleguide-specific.css': './public/styleguide/css/styleguide-specific.scss'
}
}
},
nodeunit: {
all: ['test/*_tests.js']
},
browserSync: {
dev: {
options: {
server: './public',
watchTask: true,
plugins: [
{
module: 'bs-html-injector',
options: {
files: './public/index.html'
}
}
]
}
}
},
bsReload: {
css: './public/**/*.css'
}
});
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
//load the patternlab task
grunt.task.loadTasks('./builder/');
//if you choose to use scss, or any preprocessor, you can add it here
grunt.registerTask('default', ['patternlab', 'sass', 'copy:main']);
//travis CI task
grunt.registerTask('travis', ['nodeunit', 'patternlab']);
//TODO: this line is more efficient, but you cannot run concurrent watch tasks without another dependency.
//grunt.registerTask('serve', ['patternlab', /*'sass',*/ 'copy:main', 'browserSync', 'watch:patterns', 'watch:scss']);
grunt.registerTask('serve', ['patternlab', 'sass', 'copy:main', 'browserSync', 'watch:all']);
grunt.registerTask('build', ['nodeunit', 'concat']);
};