@mikojs/babel-plugin-import-css
v1.15.0
Published
Use to make the css files could be imported into `node` and `browser`.
Downloads
25
Maintainers
Readme
@mikojs/babel-plugin-import-css ·
Use to make the css files could be imported into node
and browser
with babel-plugin-css-modules-transform
.
Example
In
import styles from './styles.css';
Out
require(globalThis.window
? './styles.css'
: '@mikojs/babel-plugin-import-css/emptyCssFile.js');
Install
yarn add babel-plugin-css-modules-transform @mikojs/babel-plugin-import-css --dev
Add @mikojs/babel-plugin-import-css
to babel config.
...
plugins: [
...
[
'css-modules-transform',
{
keepImport: true,
},
],
'@mikojs/import-css',
...
],
...
Use with less
...
plugins: [
...
[
'css-modules-transform',
{
keepImport: true,
},
],
[
'@mikojs/import-css',
{ test: /\.less$/ },
],
...
],
...