postcss-auto-add-px

0.0.2 • Public • Published

PostCSS Auto Add Px Build Status

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.

Package Sidebar

Install

npm i postcss-auto-add-px

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

5.32 kB

Total Files

7

Last publish

Collaborators

  • tomgoutang