Nomenclature Processing Machine

    esbuild-plugin-sass
    TypeScript icon, indicating that this package has built-in type declarations

    0.6.0 • Public • Published

    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')
    
    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;
    }

    API

    Module default-exports a function, which need to be called with or without options object:

    import sass = require("sass");
    
    interface Options {
      rootDir?: string
      customSassOptions?: Omit<sass.Options, 'file'>
    }
    
    export = (options: Options = {}) => Plugin

    Supported options:

    • rootDir - folder to resolve pathes against

    • customSassOptions - options object passed to sass render function, except file option, which is overriden by plugin for each processed file

    Install

    npm i esbuild-plugin-sass

    DownloadsWeekly Downloads

    2,618

    Version

    0.6.0

    License

    ISC

    Unpacked Size

    10.7 kB

    Total Files

    8

    Last publish

    Collaborators

    • koluch