forked from akkadotnet/getakka.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
125 lines (118 loc) · 3.58 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
module.exports = function(grunt) {
var output = "web/";
var source = "src/"
var layouts = source + 'layouts';
var assets = source + 'assets';
var scss = source + '_scss';
var cssOutputDir = source + 'css';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
open : {
dev : {
path: 'http://127.0.0.1:8080/'
}
},
'livereload' : {
options : {
base : 'web',
},
files : ['web/**/*']
},
'watch': {
all: {
files: 'src/**/*.*',
tasks: ['compass', 'newer:assemble', 'sync'], // only build changed pages
options: {
livereload: true,
},
},
},
compass: {
dist: {
options: {
sassDir: scss,
cssDir: cssOutputDir,
outputStyle: 'compressed',
}
}
},
'http-server': {
'dev': {
root: "web",
port: 8080,
host: "0.0.0.0",
cache: 0,
showDir : true,
autoIndex: true,
// server default file extension
ext: "html",
// run in parallel with other tasks
runInBackground: true
}
},
sync: {
"assets" : { // copy files from source to output folder
files: [
{
expand: true,
cwd : source,
src : ['**/*.*','!**/*.hbs','!**/*.md','!**/.htm', '!**/*.scss', '!_data/**/*'],
dest : output
},
],
}
},
clean: {
all: ['web/*.html']
},
assemble: {
options: {
layout: "docs.hbs",
flatten: false,
expand: true,
layoutdir: layouts,
partials: ['src/partials/**/*'],
helpers: ['helper-gfm.js', 'helper-ifEq.js'],
assets: assets,
data: 'src/_data/*'
},
"pages": { //build all pages, hbs and markdown
files: [
{
expand: true,
cwd: source,
src: ['*.hbs','pages/**/*.hbs','**/*.md','help/**/*.htm'],
dest: output,
ext: '.html'
}
]
}
}
});
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-http-server');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-sync');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-livereload');
grunt.loadNpmTasks('grunt-git');
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-newer');
grunt.registerTask('default', [
'clean', // clean out any deleted files
'assemble', // build pages from scratch on startup
'compass',
'sync', // copy documentation to src, copy resources from src to output
'open',
'http-server', // start server
'watch'
]);
grunt.registerTask('prod', [
'clean', // clean out any deleted files
'compass', // build SCSS => CSS
'sync', // copy documentation to src, copy resources from src to output
'assemble', // build pages
]);
};