-
Notifications
You must be signed in to change notification settings - Fork 3
/
make.js
52 lines (43 loc) · 1.37 KB
/
make.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
let b = require('substance-bundler')
let path = require('path')
function _buildLib(transpileToES5, cleanup) {
b.js('./lib/substance-forms.js', {
target: {
useStrict: !transpileToES5,
dest: './dist/substance-forms.js',
format: 'umd', moduleName: 'forms', sourceMapRoot: __dirname, sourceMapPrefix: 'forms'
},
// NOTE: do not include XNode (id must be the same as used by DefaultDOMElement)
ignore: ['./XNode'],
buble: Boolean(transpileToES5),
cleanup: Boolean(cleanup)
})
}
function _minifyLib() {
b.minify('./dist/substance-forms.js', './dist/substance-forms.min.js')
}
b.task('assets', function() {
b.copy('node_modules/font-awesome', './dist/lib/font-awesome')
b.css('./node_modules/substance/substance-reset.css', './dist/substance-reset.css')
b.css('./lib/substance-forms.css', './dist/substance-forms.css', { variables: true })
})
b.task('clean', function() {
b.rm('./dist');
})
b.task('examples', function() {
b.copy('./examples/index.html', './dist/')
b.copy('./examples/comments.html', './dist/')
})
b.task('lib', function() {
_buildLib('transpile', 'clean')
_minifyLib()
})
b.task('dev:lib', function() {
_buildLib()
})
b.task('default', ['clean', 'assets', 'examples', 'lib'])
b.task('dev', ['clean', 'assets', 'examples', 'dev:lib'])
b.setServerPort(5555)
b.serve({
static: true, route: '/', folder: 'dist'
})