-
Notifications
You must be signed in to change notification settings - Fork 23
/
rollup.config.js
50 lines (47 loc) · 1.26 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
48
49
50
import path from 'path';
import fs from 'fs';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import postcss from 'postcss';
import clean from 'postcss-clean';
import copy from 'rollup-plugin-copy';
import terser from '@rollup/plugin-terser';
import sass from 'rollup-plugin-sass';
import css from 'rollup-plugin-css-only';
import { minify } from 'csso';
const config = {
input: 'src/js/main.js',
output: {
file: 'material/dist/bundle.js',
format: 'iife'
},
plugins: [
resolve({
browser: true
}),
commonjs(),
css({
output: function (styles) {
fs.writeFileSync(path.join('material', 'dist', 'lib.css'), minify(styles).css);
}
}),
sass({
output: true,
processor: css => postcss([clean])
.process(css, { from: undefined })
.then(result => result.css)
}),
process.env.NODE_ENV === 'production' ? terser() : null,
copy({
targets: [
{ src: 'src/assets/fonts', dest: 'material/dist' },
{ src: 'src/assets/img', dest: 'material/dist' },
{ src: 'node_modules/bootstrap/dist/fonts/*', dest: 'material/dist/fonts' }
]
})
],
watch: {
exclude: 'node_modules/**'
}
};
export default config;