-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
140 lines (122 loc) · 3.54 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
/*
* pagination-example
* https://github.com/assemble/pagination-example
* Copyright (c) 2013 Jon Schlinkert, Brian Woodward, Contributors
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
var pretty = require('pretty');
// Project configuration.
grunt.initConfig({
site : grunt.file.readYAML('_config.yml'),
pkg : grunt.file.readJSON('package.json'),
vendor: grunt.file.readJSON('.bowerrc').directory,
bootstrap: '<%= vendor %>/bootstrap',
// Generate components
components: {
bootstrap: {
src: ['<%= vendor %>/bootstrap/less/*.less'],
dest: 'tmp/components/'
}
},
get: {
options: {
pretty: true,
host: 'getbootstrap.com'
},
pages: {
options: {append: '/index'},
files: [
{dest: '<%= vendor %>/', ext: '.html', src: ['components', 'css', 'javascript']}
]
}
},
reverse: {
options: {
ext: 'hbs',
parent: 'bs-example',
flatten: true
},
bootstrap: {
files: {
'tmp/': ['<%= vendor %>/*.html']
}
}
},
matter: {
components: {
files: [
{dest: 'tmp/', cwd: 'components', src: ['**/*.hbs'], ext: '.hbs', expand: true}
]
}
},
assemble: {
options: {
site: '<%= site %>',
flatten: true,
data: ['components/**/*.json', 'data/**/*.json'],
assets: '<%= site.dest %>/assets',
helpers: ['handlebars-helper-lorem', 'templates/helpers/*.js'],
partials: ['templates/includes/*.hbs'],
layoutdir: 'templates/layouts',
layout: 'component.hbs',
postprocess: function(src) {
return pretty(src);
}
},
components: {
files: [
{expand: true, cwd: 'templates', src: ['*.hbs'], dest: '<%= site.dest %>/', ext: '.html'},
{expand: true, cwd: 'components', src: ['**/*.hbs'], dest: '<%= site.dest %>/components/', ext: '.html'}
]
}
},
/**
* Compile LESS to CSS
*/
less: {
options: {
paths: ['theme/bootstrap', 'theme/components', 'theme']
},
base: {
src: 'theme/base.less',
dest: '<%= assemble.options.assets %>/css/base.css'
},
docs: {
src: ['theme/theme.less'],
dest: '<%= assemble.options.assets %>/css/docs.css'
},
components: {
options: {
// Each referenced file has something required by other .less files.
imports: {
reference: ['variables', 'mixins', 'utilities', 'scaffolding', 'buttons', 'forms']
}
},
files: [
{
expand: true,
cwd: 'components',
src: ['**/*.less', '!{bootstrap,variables,mixins}.less'],
dest: '<%= site.dest %>/components/',
ext: '.css'
}
]
}
},
// Before creating new files, remove files from previous build.
clean: ['<%= site.dest %>/**/*.html']
});
// Load npm plugins to provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-components');
grunt.loadNpmTasks('grunt-reverse');
grunt.loadNpmTasks('grunt-matter');
grunt.loadNpmTasks('grunt-get');
grunt.loadNpmTasks('assemble-less');
grunt.loadNpmTasks('assemble');
// Default task to be run.
// grunt.registerTask('default', ['clean', 'components', 'get', 'reverse', 'matter', 'assemble']);
grunt.registerTask('default', ['clean', 'less', 'assemble']);
};