https://github.com/lazycoffee/lc-bun-plugin
Some useful plugins for bun bundler.
https://github.com/lazycoffee/lc-bun-plugin
bun bundler less
Last synced: about 2 months ago
JSON representation
Some useful plugins for bun bundler.
- Host: GitHub
- URL: https://github.com/lazycoffee/lc-bun-plugin
- Owner: lazycoffee
- License: mit
- Created: 2025-03-05T05:57:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-06T03:40:37.000Z (over 1 year ago)
- Last Synced: 2025-10-24T19:43:48.374Z (8 months ago)
- Topics: bun, bundler, less
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/lc-bun-plugin
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lc-bun-plugin
Some useful plugins for bun bundler.
- bunPluginLess - A less compiler plugin
- bunPluginHtml - Use one html template for multi entry points
- bunPluginSvg - Import svg as raw string
## Usage
Just use it like any other bun plugin.
```js
import { bunPluginLess, bunPluginHtml, bunPluginSvg } from "lc-bun-plugin";
import path from "path";
async function main() {
const BunPluginLess = bunPluginLess({
sourceMap: { sourceMapFileInline: true },
// extra config: https://lesscss.org/usage/#programmatic-usage
});
const buildConfig = {
// bunPluginHtml not support .html as entry point
// you can use .js or .mjs
entrypoints: ["./index.js"],
outdir: "./dist",
plugins: [BunPluginLess, bunPluginSvg()],
};
const { outputs } = await Bun.build();
// has to be called after bun.build()
bunPluginHtml({
templatePath: path.join(process.cwd(), "front/template.html"),
// I need to known the output path to inject the bundle path
outputs,
// I also need to known the build config to inject built assets
buildConfig,
});
}
main();
```
Or you can find an example in 'playground/build.mjs';