-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGruntfile.js
83 lines (82 loc) · 1.68 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
module.exports = function(grunt) {
grunt.initConfig({
watch: {
livereload: {
files: ['**/*.md', '**/*.html', '**/*.scss', '!node_modules/**/*', '!build/**/*', '!_site/**/*', '!export/**/*'],
tasks: ['copy', 'matter', 'metalsmith'],
options: {
livereload: true
}
}
},
connect: {
server: {
options: {
base: 'build',
hostname: '*',
livereload: true
}
}
},
copy: {
main: {
files: [{
expand: true,
src: ['**/*.md', '!README.md', '!node_modules/**/*', '!_*/**/*', '!src/**/*'],
dest: 'src/'
}]
},
sass: {
src: '_sass/*',
dest: 'src/',
},
activities: {
expand: true,
cwd: '_activities/',
src: '**',
dest: 'src/activities/'
}
},
metalsmith: {
main: {
options: grunt.file.readJSON('metalsmith.json'),
src: 'src',
dest: 'build'
}
},
matter: {
style: {
options: {
strip: true
},
files: [{
src: ['style.scss'],
dest: 'src/style.scss'
}]
}
},
'string-replace': {
dist: {
files: [{
expand: true,
src: 'build/**/*.html',
dest: './',
}],
options: {
replacements: [{
pattern: / id="-"/g,
replacement: ' id="section"'
}]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-metalsmith');
grunt.loadNpmTasks('grunt-matter');
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask('default', ['copy', 'matter', 'metalsmith', 'string-replace', 'connect', 'watch']);
grunt.registerTask('build', ['copy', 'matter', 'metalsmith', 'string-replace']);
};