1 import svelte from 'rollup-plugin-svelte';
2 import commonjs from '@rollup/plugin-commonjs';
3 import resolve from '@rollup/plugin-node-resolve';
4 import livereload from 'rollup-plugin-livereload';
5 import { terser } from 'rollup-plugin-terser';
6 import css from 'rollup-plugin-css-only';
7 import { readFileSync, writeFileSync } from 'fs';
9 const production = !process.env.ROLLUP_WATCH;
15 if (server) server.kill(0);
21 server = require('child_process').spawn('yarn', ['start', '-d'], {
22 stdio: ['ignore', 'inherit', 'inherit'],
26 process.on('SIGTERM', toExit);
27 process.on('exit', toExit);
38 file: 'dist/build/bundle.js'
43 // enable run-time checks when not in production
48 output: function (styles, styleNodes) {
49 // make sure global_styles.css gets appended to bundle.css,
51 // The ':global()' rules (https://svelte.dev/docs#style) get
52 // prepended so we can't use them to overwrite bootstrap.css
54 let global_styles = readFileSync('src/global_style.css');
55 styles += global_styles;
56 writeFileSync('dist/build/bundle.css', styles);
60 // If you have external dependencies installed from
61 // npm, you'll most likely need these plugins. In
62 // some cases you'll need additional configuration -
63 // consult the documentation for details:
64 // https://github.com/rollup/plugins/tree/master/packages/commonjs
71 // In dev mode, call `npm run start` once
72 // the bundle has been generated
73 !production && serve(),
75 // Watch the `dist` directory and refresh the
76 // browser on changes when not in production
77 !production && livereload('dist'),
79 // If we're building for production (npm run build
80 // instead of npm run dev), minify
81 production && terser()