JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7287
  • Score
    100M100P100Q130503F
  • License MIT

The missing style loader for esbuild.

Package Exports

  • @hyrious/esbuild-plugin-style

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hyrious/esbuild-plugin-style) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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