Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 726 Bytes

README.md

File metadata and controls

46 lines (33 loc) · 726 Bytes

@hyrious/esbuild-plugin-style

The missing style-loader for esbuild.

Usage

const { style } = require("@hyrious/esbuild-plugin-style");

require("esbuild").build({
  entryPoints: ["app.js"],
  bundle: true,
  outfile: "out.js",
  plugins: [style()],
}).catch(() => process.exit(1));

Given such app.js and style.css:

import "./style.css";
console.log(1);
body { color: red; }

Outputs (things like):

let style = document.createElement("style");
style.append("body { color: red }");
document.head.append(style);
console.log(1);

Options

export function style({ minify = true, charset = "utf8" }): Plugin;

License

MIT @ hyrious