@pieced/babel-plugin-auto-css-modules
v1.0.11
Published
<h1 align="center">@pieced/babel-plugin-auto-css-modules 👋</h1> <p align="center"> <a href="https://www.npmjs.com/package/@pieced/babel-plugin-auto-css-modules" target="_blank"> <img alt="Version" src="https://img.shields.io/npm/v/@pieced/babel-plu
Downloads
35
Maintainers
Readme
Automatically identify CSS Modules
Install
npm i @pieced/babel-plugin-auto-css-modules
Usage
import styles from 'a.scss'; //===>import styles from 'a.scss?modules'
Without options:
{
"plugins": [
"@pieced/babel-plugin-auto-css-modules"
]
}
With options:
{
"plugins": [
[
"@pieced/babel-plugin-auto-css-modules",
{
"generate": "function"
}
]
]
}
Options
generate type function
(value, suffix) => {
const CSS_EXT_NAMES = ['.css', '.less', '.sass', '.scss', '.stylus', '.styl'];
if (CSS_EXT_NAMES.includes(suffix)) return `${value}?modules`;
}
// return import styles from 'a.scss?modules'