npm.io
1.0.1 • Published 9 years ago

gulp-stylus-vars

Licence
MIT
Version
1.0.1
Deps
3
Vulns
0
Weekly
0
Stars
2

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.

Keywords