-
Install -
Usage -
Passing Arguments to Plugins -
Custom Processing -
Warning Handler -
Asynchronous Processing
$ npm install --save-dev poststylus
stylus ( css ) . use ( poststylus ( [
'autoprefixer' ,
'rucksack-css'
] ) )
var gulp = require ( 'gulp' ) ,
stylus = require ( 'gulp-stylus' ) ,
poststylus = require ( 'poststylus' ) ,
autoprefixer = require ( 'autoprefixer' ) ,
rucksack = require ( 'rucksack-css' ) ;
gulp . task ( 'stylus' , function ( ) {
gulp . src ( 'style.styl' )
. pipe ( stylus ( {
use : [
poststylus ( [ autoprefixer , rucksack ] )
]
} ) )
. pipe ( gulp . dest ( '.' ) )
} ) ;
gulp . task ( 'default' , [ 'stylus' ] ) ;
var postcss = function ( ) {
return require ( 'poststylus' ) ( [ 'autoprefixer' , 'rucksack-css' ] ) ;
}
module . exports = function ( grunt ) {
grunt . initConfig ( {
stylus : {
compile : {
options : {
use : [ postcss ]
} ,
files : {
'style.css' : 'style.styl'
}
}
}
} ) ;
grunt . loadNpmTasks ( 'grunt-contrib-stylus' ) ;
} ;
var poststylus = require('poststylus'), webpack = require('webpack'); module: { loaders: [ { test: /\.styl$/, loader: 'style-loader!css-loader!stylus-loader' } ] }, stylus: { use: [ poststylus([ 'autoprefixer', 'rucksack-css' ]) ] }
module: {...}, plugins: [ new webpack.LoaderOptionsPlugin({ options: { stylus: { use: [poststylus([ 'autoprefixer', 'rucksack-css' ])] } } }) ]
$ stylus --use ./ node_modules/poststylus --with " ['autoprefixer'] " --out test.css < test.styl
var autoprefixer = require ( 'autoprefixer' ) ;
stylus ( css ) . use ( [
poststylus ( [
autoprefixer ( { browsers : [ 'ie 8' ] } )
] )
] )
stylus --use ./node_modules/poststylus --with " [require(' ${PWD} /node_modules/autoprefixer')({ browsers: ['ie 8'] })] " --out test.css < test.styl
var myPostcss = postcss . plugin ( 'custom' , function ( ) {
return function ( css ) {
// PostCSS processing here
} ;
} ) ;
// Pipe it into poststylus
stylus ( css ) . use ( poststylus ( [ myPostcss ( ) ] ) ) ;
stylus ( css ) . use ( poststylus ( [
'autoprefixer' ,
'rucksack-css'
] , function ( message ) {
console . info ( message ) ;
} ) ) ;