-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
112 lines (105 loc) · 2.77 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sassdoc');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-browser-sync');
var BUILD_PATH = './docs/build/',
WATCH_PATHS = [
'docs/index.html',
'docs/templates/**/*.*',
'scss/**/*.scss'
];
grunt.initConfig({
package: grunt.file.readJSON('package.json'),
'watch': {
files: WATCH_PATHS,
tasks: ['default'] // TODO: only call tasks needed for specific file type changes
},
'browserSync': {
options: {
watchTask: true,
server: {
baseDir: BUILD_PATH
}
},
bsFiles: {
src: [
BUILD_PATH + '**/*.css',
BUILD_PATH + '**/*.html'
]
}
},
'exec': {
options: {
shell: 'bash'
},
webpack: 'webpack',
seldon: 'node node_modules/seldon/seldon.js seldon.config.json',
docIndex: 'cp ./docs/index.html ./' + BUILD_PATH + 'index.html',
cpExamples: 'cp -R ./docs/examples/ ' + BUILD_PATH + 'examples/'
},
'sassdoc': {
default: {
src: 'scss/utils/**/*.scss',
options: {
dest: BUILD_PATH + 'sassdoc/',
theme: 'flippant',
display: {
access: ['public'],
alias: true,
watermark: false
}
}
}
},
'clean': {
sassdoc: ["./sassdoc/"],
docs: [BUILD_PATH]
},
'gh-pages': {
options: {
base: BUILD_PATH
},
src: ['**']
},
'preprocess': {
inline: {
src: [
BUILD_PATH + 'index.html',
BUILD_PATH + 'seldon/doc.html',
BUILD_PATH + 'examples/*.html'
],
options: {
inline: true,
context: {
DEBUG: false,
'VERSION': '<%= package.version %>',
'FONT_URL': '//www.meetup.com/mu_static/en-US/graphik.c2ab8a6.css',
'GITHUB_URL': '//github.com/meetup/swarm-sasstools',
'CSS_PATH': './swarm-sasstools.css',
'SQ2_URL': '//meetup.github.io/sassquatch2/bundle/sassquatch.css'
}
}
}
}
});
grunt.registerTask('default', [
'clean:docs', // cleans built docs
'exec:webpack', // (webpack) compile Sass
'sassdoc', // generates sassdoc docs for Sass API
'exec:seldon', // generates seldon docs for CSS class API
'exec:docIndex', // creates `index.html` landing page for built docs
'exec:cpExamples', // creates `examples/*.html` pages for built docs
'preprocess', // updates built docs with version and asset urls
'clean:sassdoc' // rm extraneous build artifact from sassdoc (sassdoc bug)
]);
grunt.registerTask('serve', [
'default', // initial compile
'browserSync', // enable live reload
'watch' // rebuild on src changes
]);
grunt.registerTask('ghpages', ['default', 'gh-pages']);
};