-
Notifications
You must be signed in to change notification settings - Fork 5
/
gruntfile.js
95 lines (82 loc) · 2.09 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
const grunt = require('grunt');
require('./scripts/grunt-markdown');
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
banner: '/* (c) 2018, Mathigon/Parallel */\n\n',
clean: ['functions/build'],
rollup: {
app: {files: {'static/parallel.js': ['static/scripts/main.js']}}
},
babel: {
options: {
presets: [['@babel/preset-env', {
modules: false,
useBuiltIns: false,
loose: true
}], ['minify', {
builtIns: false, // This fixes the "Couldn't find intersection" error.
mangle: { keepClassName: true } // Required for duplicate Geometry classes.
}]],
comments: false,
minified: true
},
app: {files: {'static/parallel.js': 'static/parallel.js'}}
},
less: {
app: {files: {'static/parallel.css': 'static/styles/main.less'}}
},
autoprefixer: {
app: {files: {'static/parallel.css': 'static/parallel.css'}}
},
cssmin: {
options: {banner: '<%= banner %>'},
app: {files: {'static/parallel.css': 'static/parallel.css'}}
},
markdown: {
app: {files: [{
expand: true,
cwd: 'pages',
src: ['*.md'],
dest: 'functions/build',
ext: '.html'
}]}
},
yaml: {
options: {spaces: 2},
app: {files: [{
expand: true,
cwd: 'static',
src: ['*.yaml'],
dest: 'functions/build',
ext: '.json'
}]}
},
copy: {
app: {
src: 'private/service-account.json',
dest: 'functions/build/service-account.json'
},
},
watch: {
markdown: {
files: ['pages/*.md'],
tasks: ['markdown']
},
less: {
files: 'static/styles/*.less',
tasks: ['less', 'autoprefixer']
},
js: {
files: 'static/scripts/*.js',
tasks: ['rollup', 'babel']
}
},
concurrent: {
app: {
options: {limit: 3, logConcurrentOutput: true},
tasks: ['watch:markdown', 'watch:less', 'watch:js']
}
}
});
grunt.registerTask('build', ['rollup', 'less', 'autoprefixer', 'markdown', 'yaml', 'copy']);
grunt.registerTask('default', ['clean', 'build', 'babel', 'cssmin']);