forked from riot/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
35 lines (33 loc) · 869 Bytes
/
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
import riot from 'rollup-plugin-riot'
import nodeResolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import buble from 'rollup-plugin-buble'
import postcss from 'postcss'
import postcssCssnext from 'postcss-cssnext'
export default {
entry: 'src/main.js',
dest: 'dist/bundle.js',
plugins: [
riot({
style: 'cssnext',
parsers: {
css: { cssnext }
}
}),
nodeResolve({ jsnext: true }),
commonjs(),
buble()
],
format: 'iife'
}
/**
* Transforms new CSS specs into more compatible CSS
*/
function cssnext (tagName, css) {
// A small hack: it passes :scope as :root to PostCSS.
// This make it easy to use css variables inside tags.
css = css.replace(/:scope/g, ':root')
css = postcss([postcssCssnext]).process(css).css
css = css.replace(/:root/g, ':scope')
return css
}