0.0.3 • Published 2 years ago

esbuild-plugin-sass-modules v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

esbuild-plugin-sass

Node.js CI

Plugin for esbuild to support SASS styles

Install

npm i esbuild esbuild-plugin-sass

Usage example

Create file src/test.scss:

body {
  &.isRed {
    background: red;
  }
}

Create file src/index.js:

import './test.scss'

Create file build.js:

const esbuild = require('esbuild');
const sassPlugin = require('esbuild-plugin-sass-modules')

esbuild.build({
    entryPoints: ['src/index.js'],
    bundle: true,
    outfile: 'bundle.js',
    plugins: [sassPlugin()],
}).catch((e) => console.error(e.message))

Run:

node build.js

File named bundle.css with following content will be created:

body.isRed {
  background: red;
}