-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
executable file
·38 lines (35 loc) · 892 Bytes
/
build.js
File metadata and controls
executable file
·38 lines (35 loc) · 892 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
#!/usr/bin/env node
const path = require('path')
const esbuild = require('esbuild');
const {sassPlugin} = require('esbuild-sass-plugin');
const assetsManifest = require('esbuild-plugin-manifest');
const esbuildOptions = {
logLevel: 'info',
entryPoints: [
"resources/css/app.scss",
],
bundle: true,
color: true,
minify: false,
sourcemap: true,
platform: 'browser',
outdir: 'public/assets',
entryNames: '[name]-[hash]',
loader: {
'.svg': 'file',
'.png': 'file',
},
plugins: [
assetsManifest(),
sassPlugin({
precompile(source, pathname) {
return source.replace(/(url\(['"])(\.\.?\/)([^'"]+['"]\))/g, `$1${path.dirname(pathname)}/$2$3`)
},
}),
],
};
esbuild
.context(esbuildOptions)
.then(async (ctx) => {
await ctx.watch();
});