-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
37 lines (32 loc) · 1001 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
36
37
import svelte from 'rollup-plugin-svelte'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import css from 'rollup-plugin-css-only'
import postcss from 'rollup-plugin-postcss'
import path from 'path'
import { glob } from 'glob'
const templates = glob.sync('views/*.svelte')
const serverSideConfig = (template) => ({
input: template,
output: {
//file: template.replace('svelte', 'js'),
file:`${template.replace('.svelte', '.js').replace('views/', 'views/templates/')}`,
format: 'esm',
},
plugins: [
svelte({
compilerOptions: {
generate: 'ssr',
}
}),
//css({output: `static/${template}.css`}),
postcss({
extract: path.resolve(`${template.replace('.svelte', '').replace('views/', 'views/templates/')}.css`)
}),
resolve(),
commonjs(),
]
});
export default [
...templates.map(serverSideConfig),
];