-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (40 loc) · 1.32 KB
/
gulpfile.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
"use strict" // eslint-disable-line strict
const fs = require("fs-extra")
const rollup = require("rollup")
const resolve = require("rollup-plugin-node-resolve")
const commonjs = require("rollup-plugin-commonjs")
const minify = require("babel-minify")
const t = {
rollup(contents, file) {
return rollup.rollup({ input: file.path, plugins: [resolve(), commonjs()] })
.then((bundle) => bundle.generate({ format: "iife", name: "Animator" }))
.then(({ code }) => code)
},
minify(contents) {
return minify(contents, { mangle: { exclude: ["Animator", "Siteswap"] }, mergeVars: /* for some reason this breaks something */ false }).code
}
}
const configuration = {
tasks: {
"build": {
watch: "src/*.js",
series: ["build:worker", "build:js", () => fs.removeSync("./src/workers/")]
},
"build:js": {
src: "src/_entry.js",
dest: "dist/",
rename: "sani.js",
transforms: [t.rollup, t.minify]
},
"build:worker": {
src: "./node_modules/gif.js/dist/gif.worker.js",
dest: "src/workers/",
rename: "gif.js",
transforms: [(contents) => `export default \`${contents}\``]
},
"default": {
series: ["build", "watch"]
}
}
}
require("glupost")(configuration)