0.0.1 • Published 5 months ago

esbuild-plugin-style-inject v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

README

npm version install size npm downloads

An esbuild plugin to inject styles (less or css) into the document.

This plugin will bundle the less or css code into the JavaScript code.

# Install less as peer dependency
npm i less

# Install the plugin
npm i esbuild-plugin-style-inject

Usage

const { build } = require('esbuild')
const { styleInjectPlugin } = require('esbuild-plugin-style-inject')

build({
  bundle: true,
  outdir: 'dist',
  entryPoints: ['./src/index.js'],
  plugins: [styleInjectPlugin()]
})

Options

const { build } = require('esbuild')
const { styleInjectPlugin } = require('esbuild-plugin-style-inject')

build({
  bundle: true,
  outdir: 'dist',
  entryPoints: ['./src/index.js'],
  plugins: [
    styleInjectPlugin({
      /**
       * Inject css. Default: `true`.
       */
      css: true,

      /**
       * Inject less. Default: `true`.
       *
       * Note: The less module must be installed.
       */
      less: true
    })
  ]
})

License

MIT

0.0.1

5 months ago

0.0.1-alpha.1

5 months ago