https://github.com/unlight/fusebox-chain-plugin
Custom chain plugin for FuseBox
https://github.com/unlight/fusebox-chain-plugin
fusebox fusebox-chain-plugin
Last synced: 4 months ago
JSON representation
Custom chain plugin for FuseBox
- Host: GitHub
- URL: https://github.com/unlight/fusebox-chain-plugin
- Owner: unlight
- Created: 2017-02-28T07:58:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T18:24:17.000Z (about 8 years ago)
- Last Synced: 2025-01-24T09:35:56.283Z (4 months ago)
- Topics: fusebox, fusebox-chain-plugin
- Language: TypeScript
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fusebox-chain-plugin
Custom chain plugin for FuseBox.FEATURES
---
* Cache chained plugins
* Conditional compilationINSTALL
---
```
npm i -D fusebox-chain-plugin
```USAGE
---
```ts
import { ChainPlugin } from 'fusebox-chain-plugin';
```
```ts
// part of fusebox config
plugins: [
ChainPlugin(options, [
SassPlugin(),
CSSPlugin()
])
]
```
### Conditional compilation
All `.component.scss` files will be inlined, others `.scss` handles like usual css.
```ts
ChainPlugin({ extension: '.scss', test: /\.scss$/ }, {
'.component.scss': [
SassPlugin({ sourceMap: false }),
RawPlugin({}),
],
'.scss': [
SassPlugin({}),
CSSPlugin(),
]
}),
```API
---
```
ChainPlugin(plugins: Plugin[] | { [k: string]: Plugin[] });
ChainPlugin(options: Options, plugins: Plugin[] | { [k: string]: Plugin[] });
```
#### Options
* `extension?: string`
Will be passed to `context.allowExtension(ext)` on init.
* `extensions?: string[]`
Same as `extension`
* `test?: RegExp`
Filter files by this regexp, if not set, first in plugins array will be used.
* `hmr?: boolean`
Enable HMR.
Default: `true`
* `hmrType?: string`
Since plugin can be applied to any type of file, you muse explicitly set type of HMR file
which will be emitted (this is non-usual case and you need custom *frontend* fusebox plugin
to handle HMR properly).#### Plugin[]
Array of fusebox plugins.#### { [k: string]: Plugin[] }
Split transform pipiline by extension.DEBUG
---
* Debug benchmark `inspect node_modules\ts-node\dist\_bin.js benchmarks\benchmark.ts`