1.0.1 • Published 7 years ago

gulp-stylus-vars v1.0.1

Weekly downloads
21
License
MIT
Repository
github
Last release
7 years ago

gulp-stylus-vars

Inject variables in stylus files from a js object.

Usage

npm install gulp-stylus-vars
var stylusVars = require('gulp-stylus-vars');

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

  return gulp.src([
    'src/styles/main.styl'
  ])
    .pipe(stylusVars(variables, { verbose: true }))
    .pipe(stylus())
    .pipe(gulp.dest('dist'))
});

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

stringTest = hello
string2Test = "https://github.com/giowe/gulp-stylus-vars"
integerTest = 123

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