shareon/rollup/plugins.js

37 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2020-03-25 13:53:00 -04:00
import postcssPluginCssnano from 'cssnano';
2020-03-25 14:09:56 -04:00
import rollupPluginBanner from 'rollup-plugin-banner';
2020-03-25 13:53:00 -04:00
import rollupPluginPostcss from 'rollup-plugin-postcss';
2020-03-25 12:44:11 -04:00
import rollupPluginStrip from '@rollup/plugin-strip';
import { terser as rollupPluginTerser } from 'rollup-plugin-terser';
import rollupPluginTypescript from '@rollup/plugin-typescript';
2020-03-25 14:09:56 -04:00
export const banner = () => rollupPluginBanner(
'<%= pkg.name %> by Nikita Karamov\nInspired by Likely (https://ilyabirman.net/projects/likely/)'
2020-03-25 14:09:56 -04:00
)
2020-03-25 13:53:00 -04:00
export const postcss = (file, minify) => rollupPluginPostcss({
extract: file || true,
plugins: [
minify && postcssPluginCssnano({
preset: 'default',
})
],
})
2020-03-25 12:44:11 -04:00
export const strip = () => rollupPluginStrip({
debugger: true,
2020-03-25 14:09:56 -04:00
include: ['**/*.js', '**/*.ts'],
functions: ['console.log', 'console.debug', 'assert.*'],
2020-03-25 12:44:11 -04:00
sourceMap: false,
});
export const terser = () => rollupPluginTerser({
sourcemap: false,
output: {
comments: false,
ecma: 5,
},
});
export const typescript = () => rollupPluginTypescript();