/gulp-sassport

Sassport gulp plugin

Primary LanguageJavaScript

Gulp-Sassport

Gulp plugin for the Sassport tool. Gulp-Sassport is a light wrapper for gulp-sass, so its usage is very similar to Gulp-Sass.

Installation

npm install gulp-sassport --save-dev

Basic Usage

var gulp = require('gulp');
var sassport = require('gulp-sassport');

// Use any Sassport modules
var fooModule = require('path/to/any-sassport-module.js');

gulp.task('sass', function() {
  return gulp.src('./sass/**/*.scss')
    .pipe(sassport([ fooModule ], {
      outputStyle: 'compressed'
    }))
    .pipe(gulp.dest('./css'));
});

gulp.task('sass:watch', function() {
  gulp.watch('./sass/**/*.scss', ['sass']);
});

Options

Gulp-Sassport can be called with three arguments (all optional):

  1. An array of Sassport modules
  2. Node-Sass options
  3. Sassport options
gulp.task('sass', function() {
  return gulp.src('./sass/**/*.scss')
    .pipe(sassport(
      [ require('sassport-reference') ], // Sassport modules
      { outputStyle: 'compressed' }      // Sass options
    ))
    .pipe(gulp.dest('./css'));
});

API

Gulp-Sassport is fully extensible, as if it were a Sassport module, with these methods:

  • sassport(...).assets(localPath, remotePath)
  • sassport(...).functions(functionMap)
  • sassport(...).loaders(loaderMap)
  • sassport(...).exports(exportMap)
  • sassport(...).variables(variableMap)

EXAMPLE:

gulp.task('sass', function() {
  return gulp.src('./sass/**/*.scss')
    .pipe(sassport([], { outputStyle: 'compressed' })
      .assets(__dirname + '/assets', 'public/assets')
    )
    .pipe(gulp.dest('./css'));
});

See the Sassport documentation for more info.