-
Notifications
You must be signed in to change notification settings - Fork 20
/
fuse.js
37 lines (33 loc) · 978 Bytes
/
fuse.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
const extractMediaQuery = require('postcss-extract-media-query');
const extractMediaQueryConfig =
require('./postcss.config').plugins['postcss-extract-media-query'];
const { FuseBox, PostCSSPlugin, CSSPlugin } = require('fuse-box');
const { src, task, exec, context } = require('fuse-box/sparky');
context(
class {
getConfig() {
return FuseBox.init({
homeDir: 'src',
output: 'dist/$name.js',
target: 'browser@es2015',
ensureTsConfig: false,
plugins: [
[
PostCSSPlugin([extractMediaQuery(extractMediaQueryConfig)]),
CSSPlugin({
outFile: (file) => `dist/${file}`,
}),
],
],
});
}
}
);
task('clean', async (context) => {
await src('./dist').clean('dist/').exec();
});
task('default', ['clean'], async (context) => {
const fuse = context.getConfig();
fuse.bundle('example').instructions('> example.js');
await fuse.run();
});