Skip to content

osaton/gulp-sass-variables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this

Add Sass variables to gulp stream, so that you can use for example environment variables in your Sass build process.

Supports strings, numbers and booleans.

Installation

$ npm install gulp-sass-variables --save-dev

Usage

gulpfile.js

var gulp = require('gulp'),
    argv = require('yargs').argv,
    sassVariables = require('gulp-sass-variables'),
    sass = require('gulp-sass');

// Compile css
gulp.task('css', function () {
  return gulp.src('./src/scss/master.scss')
             .pipe(sassVariables({
               $env: argv.production ? 'production' : 'development'
             }))
             .pipe(sass())
             .pipe(gulp.dest('./dist/css'))
});

master.scss

$env: 'development' !default;
$path: '/dev/path/' !default;

@if($env == 'production') {
  $path: '/prod/path';
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published