-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbuild.js
More file actions
38 lines (34 loc) · 905 Bytes
/
Copy pathbuild.js
File metadata and controls
38 lines (34 loc) · 905 Bytes
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
import path from 'node:path';
import esbuild from 'esbuild';
import { sassPlugin } from 'esbuild-sass-plugin';
import postcss from 'postcss';
import autoprefixer from 'autoprefixer';
import tailwindcss from 'tailwindcss';
import tailwindConfig from './tailwind.config.js';
export const config = {
entryPoints: ['src/index.js', 'src/style.scss'],
platform: 'browser',
bundle: true,
minify: true,
sourcemap: true,
target: ['es2020'],
outdir: 'public',
plugins: [
sassPlugin({
async transform(source) {
const { css } = await postcss(autoprefixer, tailwindcss(tailwindConfig)).process(source, { from: undefined });
return css;
},
}),
],
};
if (getLaunchFile() === 'build.js') {
// I am the main launch file
await build();
}
function build() {
return esbuild.build(config);
}
function getLaunchFile() {
return path.basename(process.argv[1]);
}