-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
122 lines (117 loc) · 2.9 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
/*global module, require*/
module.exports = function (grunt) {
'use strict';
var globalConfig = {
docs: 'node_modules/bagel-styleguide/docs',
styleguide: 'guide',
dist: {
root: 'dist',
docs: 'dist/docs',
style: 'dist/style'
}
};
grunt.initConfig({
globalConfig: globalConfig,
pkg: grunt.file.readJSON('./package.json'),
assemble : {
docs: {
options: {
assets: '<%= globalConfig.docs %>/assets',
flatten: false,
partials: ['<%= globalConfig.docs %>/partials/*.hbs'],
layout: '<%= globalConfig.docs %>/layouts/default.hbs',
data: ['<%= globalConfig.docs %>/data/*.{json,yml}','config.{json,yml}']
},
files: [{
expand: true,
cwd: '<%= globalConfig.styleguide %>',
src: ['**/*.hbs'],
dest: '<%= globalConfig.dist.docs %>'
}]
}
},
clean: {
docs: {
files : [
{
dot: true,
src: ['<%= globalConfig.dist.docs %>/*']
}
]
}
},
copy: {
docs: {
files: [
{
expand: true,
cwd: '<%= globalConfig.docs %>/assets/',
src: ['images/*', 'javascripts/**/*.js'],
dest: '<%= globalConfig.dist.docs %>/assets/'
},
{
expand: true,
cwd: '<%= globalConfig.docs %>/assets/',
src: ['stylesheets/*.css'],
dest: '<%= globalConfig.dist.docs %>/'
}
]
}
},
sass: {
options: {
loadPath: ['./', 'node_modules/']
},
styleguide: {
files : {
'<%= globalConfig.dist.docs %>/stylesheets/styleguide.css': '<%= globalConfig.styleguide %>/styleguide.scss'
}
},
dist: {
files : {
'<%= globalConfig.dist.style %>/style.css': 'init.scss'
}
}
},
shared_config: {
style: {
options: {
name: 'defaultConfig',
cssFormat: 'dash',
useSassMaps: true
},
src: ['node_modules/bagel-*/config.yml', 'config.yml'], // order matters
dest: [
'config.scss'
]
}
},
myth: {
options: {
sourcemap: true
},
dist: {
files: [
{
expand: true,
cwd: '<%= globalConfig.dist.root %>/',
src: ['**/*.css'],
dest: '<%= globalConfig.dist.root %>/'
}
]
}
},
watch: {
hbs: {
files: ['**/*.hbs'],
tasks: ['assemble:docs']
}
}
});
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('assemble');
grunt.registerTask('default', ['build']);
grunt.registerTask('dist', ['sass:dist', 'myth:dist']);
grunt.registerTask('docs', ['copy:docs', 'sass:styleguide', 'myth:dist', 'assemble']);
grunt.registerTask('build', ['clean', 'shared_config', 'docs', 'dist']);
};