rollup-plugin-glob-files
v2.0.2
Published
Import files matching a glob pattern and export them as an array
Downloads
24
Readme
rollup-plugin-glob-files
Import files matching a glob pattern and export them as an array.
This plugin works similar to webpack's require.context
or require.ensure
, but for rollup.
Usage
npm i rollup-plugin-glob-files -D
// rollup.plugin.js
import globFiles from 'rollup-plugin-glob-files';
export default {
// ...
plugins: [globFiles(options)],
};
options: GlobOptions
GlobOptions
is an object which contains the following. All of the paramaters are optional except forfile
.key
: (required): This can be anything. Just remember to import by this key. If, for example, this was set to@awesome
, you would:import someArray from '@awesome';
include
: This can be a single minimatch glob pattern, or an array of them. Default is./**
.exclude
: Same asinclude
, except, of course, it excludes the files. Default is./**/node_modules/**
importStar
: Whether to useimport * as something from 'other'
in place ofimport something from 'other'
. Default isfalse
.justImport
: If the files should just be imported. Instead ofimport something from 'other'
, it just does this:import 'other'
.