-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
198 lines (177 loc) · 6.18 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
/*
* Generated on 2014-01-05
* generator-assemble v0.4.5
* https://github.com/assemble/generator-assemble
*
* Copyright (c) 2014 Hariadi Hinta
* Licensed under the MIT license.
*/
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// '<%= config.src %>/templates/pages/{,*/}*.hbs'
// use this if you want to match all subfolders:
// '<%= config.src %>/templates/pages/**/*.hbs'
module.exports = function(grunt) {
// Load grunt tasks automatically front package.json
require('load-grunt-tasks')(grunt, {
pattern: ['grunt-*', 'assemble'],
config: 'package.json',
scope: ['devDependencies']
});
//require('time-grunt')(grunt);
// Project configuration.
grunt.initConfig({
config: {
src: 'in',
dist: 'out',
lib: 'lib',
root: '<%= config.src %>/root',
stage: 'stage'
},
//
watch: {
assemble: {
files: ['<%= config.root %>/**/*.{md,html,yml,yaml}'],
tasks: ['assemble']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= config.stage %>/**/*.html',
'<%= config.stage %>/assets/**/*.css',
'<%= config.stage %>/assets/**/*.js',
'<%= config.root %>/assets/**/*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'<%= config.stage %>',
'<%= config.src %>'
]
}
}
},
assemble: {
// def: {
// options: {
// flatten: true,
// assets: '<%= config.src %>/assets',
// layoutdir: '<%= config.src %>/templates/layouts/',
// layout: 'page.html',
// data: '<%= config.src %>/**/*.{json,yml,yaml}',
// partials: '<%= config.src %>/templates/partials/**/*.html',
// helpers: ['<%= config.src %>/lib/Handlebars/helpers/**/*.js'],
// site: {
// title: 'Assemble Releases'
// }
// },
// files: [{
// expand: true, // Enable dynamic expansion.
// cwd: '<%= config.root %>', // Src matches are relative to this path.
// src: ['**/*.html'], // Actual pattern(s) to match.
// dest: '<%= config.stage %>/', // Destination path prefix.
// //ext: '.html', // Dest filepaths will have this extension.
// }]
// },
// default options
options: {
flatten: false,
assets: '<%= config.src %>/assets',
layoutdir: '<%= config.src %>/templates/layouts/',
layout: 'page.html',
data: '<%= config.src %>/**/*.{json,yml,yaml}',
partials: '<%= config.src %>/templates/partials/**/*.html',
helpers: ['<%= config.src %>/lib/Handlebars/helpers/**/*.js'],
site: {
title: 'Assemble Releases'
}
},
// root landing
root: {
options: {
},
files: [{
expand: true, // Enable dynamic expansion.
cwd: '<%= config.root %>', // Src matches are relative to this path.
src: ['*.html','*.md'], // Actual pattern(s) to match.
dest: '<%= config.stage %>', // Destination path prefix.
//ext: '.html', // Dest filepaths will have this extension.
}]
},
// the 'pages' collection
pages: {
options: {
},
files: [{
expand: true, // Enable dynamic expansion.
cwd: '<%= config.root %>/pages', // Src matches are relative to this path.
src: ['**/*.html','**/*.md'], // Actual pattern(s) to match.
dest: '<%= config.stage %>/page', // Destination path prefix.
//ext: '.html', // Dest filepaths will have this extension.
}]
},
// the 'releases' collection
releases: {
options: {
compose: {
cwd: './'
}
},
files: [{
expand: true, // Enable dynamic expansion.
cwd: '<%= config.root %>/releases', // Src matches are relative to this path.
src: ['*/*.html'], // Actual pattern(s) to match.
dest: '<%= config.stage %>/release', // Destination path prefix.
//ext: '.html', // Dest filepaths will have this extension.
}]
}
},
// clean up generated sources in stage
jsbeautifier: {
options: {
html: {
maxPreserveNewlines: 0,
preserveNewlines: true,
wrapLineLength: 0
},
css: {
},
js: {
}
},
stage: {
src: '<%= config.stage %>/**/*'
}
},
// Before generating any new files,
// remove any previously-created files.
clean: ['<%= config.stage %>/**/*']
});
grunt.registerTask('serve', [
'clean',
'assemble',
'connect:livereload',
'watch'
]);
grunt.registerTask('build', [
'clean',
'assemble',
'jsbeautifier'
]);
grunt.registerTask('default', [
'build'
]);
};