$ npm install --save-dev @taskr/postcss
Note: There should be no need to set
options.to and
options.from .
Declare your PostCSS options directly within your
taskfile.js :
exports . styles = function * ( task ) {
yield task . source ( 'src/**/*.scss' ) . postcss ( {
plugins : [
require ( 'precss' ) ,
require ( 'autoprefixer' ) ( {
browsers : [ 'last 2 versions' ]
} )
] ,
options : {
parser : require ( 'postcss-scss' )
}
} ) . target ( 'dist/css' ) ;
}
Automatically detect & connect to existing PostCSS configurations
.postcssrc -- must be JSON; see example .postcssrc.js -- can be JSON or module.exports a Function or Object; see example postcss.config.js -- can be JSON or module.exports a Function or Object; see example package.json -- must use "postcss" key & must be JSON; see example
Important: If you take this route, you only need one of the files mentioned!
// taskfile.js
exports . styles = function * ( task ) {
yield task . source ( 'src/**/*.scss' ) . postcss ( ) . target ( 'dist/css' ) ;
}
// .postcssrc
{
"plugins" : {
"precss" : { } ,
"autoprefixer" : {
"browsers" : [ "last 2 versions" ]
}
} ,
"options" : {
"parser" : "postcss-scss"
}
}