-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
106 lines (98 loc) · 2.28 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
var childProcess = require('child_process');
module.exports = function(grunt) {
config = {
source : 'source/',
static : 'example/',
templates: 'source/templates/'
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assemble: {
options: {
layoutdir: config.templates+'layouts',
layout: 'master-layout.hbs',
partials: [ config.templates+'modules/**/*.hbs' ],
flatten: false,
expand: true,
helpers: [config.templates+'helpers/*.js', 'handlebars-helpers'],
data:config.templates+'data/**/*.json'
},
pages: {
options: {
layout: 'master-layout.hbs',
helpers: [config.templates+'helpers/*.js', 'handlebars-helpers']
},
files: [
{expand: true, ext: '.html', cwd: config.templates + 'pages/', src: '**/*.hbs', dest: config.static}
]
}
},
sass: {
build: {
files : [{
expand: true,
cwd : config.source + 'scss/',
src: '*.scss',
dest: config.static + 'css/',
ext: '.css'
}],
options : {
outputStyle : 'compressed'
}
}
},
watch: {
sass: {
files: [config.source + 'scss/{,**/}{,*.scss,*.sass}'],
tasks: ['sass:build']
},
assemblePages: {
files: [config.templates + '{,**/}{,*.hbs}', config.templates + '{,**/}{,*.json}'],
tasks: [
'assemble:pages'
]
},
livereload: {
options: {
livereload: true
},
files: [
config.templates + '{,**/}*.html',
config.static + '{,**/}*.{css,js,png,jpg,jpeg,gif,webp,svg}',
config.source + '{,**/}*.{png,jpg,jpeg,gif,webp,svg,json}'
]
}
},
'http-server': {
dev: {
root: config.static,
port: 8080,
host: "127.0.0.1",
// run in parallel with other tasks
runInBackground: true,
// customize url to serve specific pages
customPages: {
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-http-server');
grunt.registerTask('build', [
'assemble',
'sass:build'
]);
grunt.registerTask('server', function (port) {
grunt.task.run([
'build',
'http-server',
'watch'
]);
});
// Default task(s).
grunt.registerTask('default', ['build']);
};