Use plugins based on anymatch
patterns.
Import UsePlugin
const {
start,
builtInPlugins: {
UsePlugin
}
} = require('reboost');
Add it to the plugins array
const {
start,
builtInPlugins: {
UsePlugin
}
} = require('reboost');
start({
plugins: [
UsePlugin({
include: /regex/,
use: [
// Plugins
]
})
]
})
Type: Matcher
anymatch
pattern to test file paths.
If the test passes all plugin(s) in use
will be used for the file.
Type: Matcher
anymatch
pattern to test file paths.
If the test passes the file will be excluded.
Type: ReboostPlugin | ReboostPlugin[]
Plugin(s) to use if the test passes for a file.
With the following configuration, FilePlugin
will be used for all files ending with .png
.
const {
start,
builtInPlugins: {
FilePlugin,
UsePlugin
}
} = require('reboost');
start({
plugins: [
UsePlugin({
include: /\.png$/
use: FilePlugin()
})
]
})
You can use multiple plugins -
UsePlugin({
include: '**/some-glob/*',
use: [
Plugin1(),
Plugin2(),
// and more
]
})
Also, you can pass multiple rules/options, like so
UsePlugin(
{
include: '**/some-glob/*',
use: Plugin1()
},
{
include: '**/another-glob/*',
use: Plugin2()
}
)
You can use relative globs, they would be resolved against rootDir.
UsePlugin({
include: './src/**/*.js',
use: Plugin()
})