gulp-stylus-vars

1.0.1 • Public • Published

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.

Package Sidebar

Install

npm i gulp-stylus-vars

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • giovanni.bruno