PostCSS plugin to replace class name by giving key-value mapping in options.
npm install postcss-class-rename --save-dev
postcss({
plugins: [
require('autoprefixer'),
require('postcss-class-rename')({
// replace 'button-' in class name to 'btn-'
button-: 'btn-',
// All options are treated as replacement mapping
...
})
]
}),
const rename = require('postcss-class-rename');
module.exports = ({ env }) => {
plugins: [
rename({
// All options are treated as replacement mapping
button-: 'btn-',
...
})
]
}