0.1.0-alpha.11 • Published 4 years ago

@webscaffold/task-css-compiler v0.1.0-alpha.11

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

@web-scaffold/task-css-compiler

WEB Scaffold task for compiling Sass to css, running PostCSS and optimizing the output.

Install

$ npm install --save-dev @webscaffold/task-css-compiler

Usage

const cssCompiler = require('@webscaffold/task-css-compiler');

await cssCompiler('path/to/input.scss', 'path/to/output/folder', {
	taskName: 'css compiler',
	isDebug: true,
	buildPath: 'path/to/build/folder/for/asset-manifest-style.json',
	sass: {
		sourceMapEmbed: false 
	}
});

This will compile the entry Scss file to CSS will run PostCSS on top and based on settings will optimize the file with clean-css.

API

cssCompiler(input, destination, options?)

Returns a Promise<string[]> with the destination file paths.

input

Type: string

Entry sass file path.

destination

Type: string

Destination directory.

options

Type: object

Options object that can be passed.

sass

Type: object

Options are passed to Sass compiler.

taskName

Type: string Default: css-compiler

Task name that will be used by the logger to namespace the logs.

taskColor

Type: string Default: #FFD166

The color used by the logger to log to the console the task output.

eventBus

Type: object Default: undefined

The EventEmitter event bus that will be used to emit bs:reload for Browsersync.

Licensing

MIT © Radu Micu