Skip to content

pmrotule/gulp-sass-vars

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-sass-vars

Inject variables in sass files from a js object.

Usage

npm install gulp-sass-vars
var sassVars = require('gulp-sass-vars');

gulp.task('sass', function() {
  var variables = {
    stringTest: "hello",
    string2Test: "https://github.com/giowe/gulp-sass-vars",
    integerTest: 123,
  };

  return gulp.src([
    'src/styles/main.scss'
  ])
    .pipe(sassVars(variables, { verbose: true }))
    .pipe(sass())
    .pipe(gulp.dest('dist'))
});

This script will prepend the following code to your main.scss file:

$stringTest: hello;
$string2Test: "https://github.com/giowe/gulp-sass-vars";
$integerTest: 123;

So you can use all those variables inside your sass file. Quotes will be added when needed via regex.

About

Inject variables in sass files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published