Skip to content

Instantly share code, notes, and snippets.

@bolasblack
Created March 16, 2014 14:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bolasblack/9584239 to your computer and use it in GitHub Desktop.
Save bolasblack/9584239 to your computer and use it in GitHub Desktop.
through = require 'through2'
cssWhitespaceCompiler = require 'css-whitespace'
rework = require 'rework'
rework_calc = require 'rework-calc'
rework_vars = require 'rework-vars'
rework_import = require 'rework-importer'
mixins = {
appearance: (value) ->
'-webkit-appearance': value
transform: (value) ->
'-webkit-transform' : value
'-moz-transform' : value
'-ms-transform' : value
'-o-transform' : value
'transform' : value
}
module.exports = ->
through.obj (file, enc, cb) ->
if file.isStream()
@emit 'error', new gutil.PluginError 'gulp-rework', 'Streaming not supported'
return cb()
css = cssWhitespaceCompiler file.contents.toString()
file.contents = new Buffer(rework(css)
.use(rework_import
path: 'styles/app.styl'
base: 'src/'
whitespace: true
)
.use rework.mixin mixins
.use rework_vars()
.use rework_calc
.toString()
)
@push file
cb()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment