@averay/gulp-sass
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@averay/gulp-sass

View code coverage on codecov

A Gulp plugin to compile Sass files with the modern, high performance sass-embedded package.

npm install @averay/gulp-sass

Usage

Pipe the exported function into a Gulp stream:

import gulpSass from '@averay/gulp-sass';

function css() {
  gulp
    .src('css/**/*.{sass,scss}')
    .pipe(/* Apply plugins */)
    .pipe(gulpSass())
    .pipe(gulp.dest('...'));
}

The underlying Sass library can be accessed through the additional sass export (e.g. import { sass } from '@averay/gulp-sass'), or by directly importing the sass-embedded package.

Options

The function accepts an optional Sass JavaScript API StringOptions object argument.

Custom Functions

Custom Sass functions can be declared using the functions property of the options object:

import gulpSass, { sass } from '@averay/gulp-sass';

gulp.src('...').pipe(
  gulpSass({
    functions: {
      'pow($base, $exponent)': (args) => {
        const base = args[0].assertNumber('base').assertNoUnits('base');
        const exponent = args[1]
          .assertNumber('exponent')
          .assertNoUnits('exponent');

        return new sass.SassNumber(Math.pow(base.value, exponent.value));
      },
    },
  }),
);

See the Sass documentation for additional details.


MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i @averay/gulp-sass

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

54.6 kB

Total Files

18

Last publish

Collaborators

  • adamaveray