Skip to content

Commit

Permalink
use sass
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdc committed Aug 18, 2024
1 parent 5a2b4ef commit b22db95
Show file tree
Hide file tree
Showing 6 changed files with 877 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
gh release create "$tag" \
--title="$tag" \
--draft \
main.js manifest.json styles.css
./dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store

# build
dist
16 changes: 9 additions & 7 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import {sassPlugin} from "esbuild-sass-plugin";

const banner =
`/*
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

const prod = (process.argv[2] === "production");
const prod = process.argv[2] === "production";

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["src/main.ts"],
entryPoints: ["src/styles.scss", "src/main.ts"],
bundle: true,
external: [
"obsidian",
Expand All @@ -31,18 +31,20 @@ const context = await esbuild.context({
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
outdir: "dist",
plugins: [sassPlugin()],
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
}
Loading

0 comments on commit b22db95

Please sign in to comment.