generated from brittni-and-the-polar-bear/generative-art-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
79 lines (73 loc) · 2.23 KB
/
rollup.config.mjs
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright (C) 2023-2024 brittni and the polar bear LLC.
*
* This file is a part of brittni and the polar bear's palette explorer project,
* which is released under the GNU Affero General Public License, Version 3.0.
* You may not use this file except in compliance with the license.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. See LICENSE or go to
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*/
import commonjs from '@rollup/plugin-commonjs';
import html from '@rollup/plugin-html';
import json from '@rollup/plugin-json';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import analyzer from 'rollup-plugin-analyzer';
import css from 'rollup-plugin-css-only';
import serve from 'rollup-plugin-serve';
import {readFileSync} from 'node:fs';
const dev = process.env.ROLLUP_WATCH === 'true';
export default {
input: './src/sketch.ts',
output: {
dir: './out/dist',
format: 'es',
name: 'GenArtExplorer_Palettes',
sourcemap: true,
preserveModules: true
},
plugins: [
commonjs(),
nodeResolve({
extensions: ['.ts']
}),
json(),
typescript(),
terser(),
analyzer({
summaryOnly: true
}),
exportFavicon(),
css({
output: 'bundle.css'
}),
html({
title: 'GenArt Explorer - Palettes',
publicPath: './'
}),
dev && serve({
contentBase: './out/dist',
host: '127.0.0.1',
port: 8080
})
]
};
function exportFavicon() {
return {
generateBundle() {
this.emitFile({
type: 'asset',
fileName: 'favicon.ico',
source: readFileSync('./assets/icon/favicon.ico')
});
}
};
}