-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrollup.config.js
51 lines (47 loc) · 1.36 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { writeFileSync } from "fs";
import autoprefixer from "autoprefixer";
import postcss from "rollup-plugin-postcss";
import { Minifier } from "css-loader-minify-class";
// import less from "rollup-plugin-less";
import { nodeResolve } from "@rollup/plugin-node-resolve";
const isProduction = !process.env.ROLLUP_WATCH;
const minifier = new Minifier({ prefix: "_" }).getLocalIdent;
const minifyClass = (localName) =>
minifier({ resourcePath: "" }, null, localName);
const generateStylesCljs = (_, json) => {
const lines = ["(ns dinsro.styles)\n"];
for (let [key, value] of Object.entries(json)) {
lines.push(`(def ${key} "${value}")`);
}
writeFileSync("src/main/dinsro/styles.cljs", lines.join("\n"));
console.log("=== Created styles.cljs ===");
};
export default [
{
input: "src/styles/main.js",
output: {
file: "resources/main/public/css/semantic.min.js",
format: "es",
},
plugins: [
nodeResolve(),
// less(),
postcss({
// minimize: true,
modules: {
generateScopedName: isProduction
? minifyClass
: "[local]-[hash:base64:5]",
getJSON: generateStylesCljs,
},
plugins: [autoprefixer],
use: {
sass: null,
stylus: null,
less: { javascriptEnabled: true },
},
extract: true,
}),
],
},
];