-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
47 lines (44 loc) · 1.46 KB
/
rollup.config.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
import fs from 'fs';
import includePaths from 'rollup-plugin-includepaths';
import filesize from 'rollup-plugin-filesize';
import {terser} from 'rollup-plugin-terser';
import postcss from 'postcss';
import cssnano from 'cssnano';
// import postCSSCustomVariables from 'postcss-css-variables';
import postCSSImport from 'postcss-import';
// Minify css.
postcss([
postCSSImport(),
// postCSSCustomVariables(), // Google search runs Chrome 41, which doesn't support CSS custom properties :(
]).process(fs.readFileSync('./public/css/combined.css', 'utf8'), {
from: './public/css/combined.css',
}).then(result => cssnano.process(result.css))
.then(result => fs.writeFileSync('./public/css/combined.min.css', result.css));
postcss([
postCSSImport(),
// postCSSCustomVariables(),
]).process(fs.readFileSync('./node_modules/highlight.js/styles/github.css', 'utf8'), {
from: './node_modules/highlight.js/styles/github.css',
}).then(result => cssnano.process(result.css))
.then(result => fs.writeFileSync('./public/css/github.min.css', result.css));
export default [{
input: 'public/js/app.js',
// treeshake: false,
output: {
file: 'public/js/app.bundle.js',
// dir: './dist',
// name: 'app',
format: 'es',
},
// experimentalDynamicImport: true,
// experimentalCodeSplitting: true,
inlineDynamicImports: true,
plugins: [
includePaths({
paths: ['node_modules'],
extensions: ['.js'],
}),
terser(), // minify
filesize(),
],
}];