postcss-auto-add-px
v0.0.2
Published
PostCSS plugin to add px unit for number of length
Downloads
3
Maintainers
Readme
PostCSS Auto Add Px
PostCSS plugin to add px unit for number of length.
const postcss = require('postcss');
const pxplugin = require('postcss-auto-add-px');
const fs = require('fs');
try{
fs.readFile('./demo/index.less', (err, css) => {
postcss([pxplugin()])
.process(css.toString(), { from: './demo/index.less', to: './demo/dist/index.less' })
.then(result => {
fs.writeFile('./demo/dist/index.less', result.css, () => true)
})
})
} catch (err) {
console.log(err)
}
Webpack config
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
vueLoaderConfig,
postcss: [require('postcss-auto-add-px')(), require('autoprefixer')()]
}
}
Usage
postcss([ require('postcss-auto-add-px') ])
See PostCSS docs for examples for your environment.