Package Exports
- @montagejs/rollup-plugin-generate-style
- @montagejs/rollup-plugin-generate-style/es/index.js
- @montagejs/rollup-plugin-generate-style/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@montagejs/rollup-plugin-generate-style) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@montagejs/rollup-plugin-generate-style
A rollup plugin, mainly used to generate automatic import js file generation of css, less and sass.
Born for babel-plugin-import~
Usage
$ npm i @montagejs/rollup-plugin-generate-style --save-devimport gStyle from '@montagejs/rollup-plugin-generate-style';
export default {
plugins: [
gStyle()
]
}
As shown below, we can see that an index.js file is generated in the style directory, which will automatically import index.css to serve babel-plugin-import.
.
📦package-xxx
┣ 📂es
┣ ┗ 📂style
┃ ┗ 📜index.css
┣ ┗ 📜index.js
┣ 📂lib
┃ ┗ 📂style
┃ ┗ 📜index.css
┃ ┗ 📜index.js
┣ 📂node_modules
┣ 📂src
┃ ┗ 📜index.tsx
┃ ┗ 📜index.less
┣ 📜.gitignore
┗ 📜package.json
↓ ↓ ↓ ↓ ↓ ↓
.
📦package-xxx
┣ 📂es
┣ ┗ 📂style
┃ ┗ 📜index.css
┃ ┗ 📜index.js(`import './index.css'`)
┣ ┗ 📜index.js
┣ 📂lib
┃ ┗ 📂style
┃ ┗ 📜index.css
┃ ┗ 📜index.js(`import './index.css'`)
┃ ┗ 📜index.js
┣ 📂node_modules
┣ 📂src
┃ ┗ 📜index.tsx
┃ ┗ 📜index.less
┣ 📜.gitignore
┗ 📜package.json