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 { spawn } from 'child_process';
7 import css from 'rollup-plugin-css-only';
8 import { readFileSync, writeFileSync } from 'fs';
10 const production = !process.env.ROLLUP_WATCH;
16 if (server) server.kill(0);
22 server = spawn('yarn', ['start', '-d'], {
23 stdio: ['ignore', 'inherit', 'inherit'],
27 process.on('SIGTERM', toExit);
28 process.on('exit', toExit);
39 file: 'dist/build/bundle.js'
44 // enable run-time checks when not in production
49 // output: function (styles, styleNodes) {
50 output: function (styles) {
51 // make sure global_styles.css gets appended to bundle.css,
53 // The ':global()' rules (https://svelte.dev/docs#style) get
54 // prepended so we can't use them to overwrite bootstrap.css
56 let global_styles = readFileSync('src/global_style.css');
57 styles += global_styles;
58 writeFileSync('dist/build/bundle.css', styles);
62 // If you have external dependencies installed from
63 // npm, you'll most likely need these plugins. In
64 // some cases you'll need additional configuration -
65 // consult the documentation for details:
66 // https://github.com/rollup/plugins/tree/master/packages/commonjs
73 // In dev mode, call `npm run start` once
74 // the bundle has been generated
75 !production && serve(),
77 // Watch the `dist` directory and refresh the
78 // browser on changes when not in production
79 !production && livereload('dist'),
81 // If we're building for production (npm run build
82 // instead of npm run dev), minify
83 production && terser()