Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Basic usage

Raimondo Mancino edited this page May 22, 2022 · 1 revision
import esb from 'esbuild';
import sassModules from '@squirrelnetwork/esbuild-sass-modules-plugin';

await esb.build(
	{ bundle: true
	, sourceRoot: 'src/'
	, entryPoints: [ 'src/index.js' ]
	, outfile: 'build/app.js'
	, plugins: [ sassModules() ]
	}
);

In the example above, sassModules() is called without arguments, which means that the default configuration will be used.

Here is the default configuration[^1]

{ sass: // uses legacy renderSync() options; see note ^1
	{ importer: null
	, indentType: 'tab'
	, indentWidth: 4
	, linefeed: 'lf'
	, omitSourceMapUrl: false
	, outFile: undefined
	, outputStyle: 'compressed'
	, sourceMap: false
	, sourceMapEmbed: false
	, sourceMapRoot: undefined
	, functions: {}
	, charset: true
	, quietDeps: true
	, verbose: false
	, logger: sass.Logger.silent
	}
, postcss:
	{ use: false
	, plugins: []
	, custom:
		{ parser: undefined
		, stringifier: undefined
		, syntax: undefined
		}
	}
}

[^1]: dart-sass fails to compile in tests; see dart-sass#1692

Clone this wiki locally