-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.ts
60 lines (59 loc) · 2.09 KB
/
rollup.config.ts
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
import {isProd,r,rr} from './script/util'
import { swc } from 'rollup-plugin-swc3';
import urlResolve from 'rollup-plugin-url-resolve';
import { ViteToml } from 'vite-plugin-toml';
import postcss from 'rollup-plugin-postcss';
import postcssOKLabFunction from '@csstools/postcss-oklab-function';
import purgecss from '@fullhuman/postcss-purgecss';
import copy from 'rollup-plugin-copy'; // copy fonts
import {nodeResolve} from '@rollup/plugin-node-resolve'; // reference npm module files
export default [
{
input : ["src/kbdHelix.js"],
output : [{dir:"static/js"}],
plugins : [urlResolve(), ViteToml(), nodeResolve(),
swc( {
include : /\.[mc]?[jt]sx?$/ , //|/\.[mc]?[jt]sx?$/|
exclude : /node_modules/ , //|/node_modules/ |
tsconfig : 'tsconfig.json' , //|'tsconfig.json' |
jsc : {
target : "es5",
loose : false,
parser : {
syntax : "ecmascript",
jsx : false,
} ,
minify : {compress:isProd,mangle:isProd},
} ,
}) ,
]},
{
input : ["src/css/kbdHelix.sass"],
output : [{dir:"sass/css/build"}],
plugins : [
postcss( {
minimize : isProd,
extract : r('sass/css/build/_kbdHelix.css'),
plugins : [postcssOKLabFunction()]
}) ,
]},
{
input : ["src/css/kbdHelixFont.sass"],
output : [{dir:"sass/css/build"}],
plugins : [
postcss( {
minimize : isProd,
extract : r('sass/css/build/_kbdHelixFont.css'),
plugins : [
purgecss({content:['./content/**/*.html.tmpl','./content/**/*.md']}),
]
}),
copy({copyOnce:true, targets:[
{src : [`${rr('@fontsource/noto-sans-symbols-2')}/../files/noto-sans-symbols-2-symbols-400-normal.woff2`],
dest : 'src/font'},
{src : [`${rr('@fontsource/noto-sans-symbols')}/../files/noto-sans-symbols-symbols-400-normal.woff2`],
dest : 'src/font'}
] ,
})
]},
];