dgkimpton/rollup-plugin-folder-input(opens in a new tab)
Language: JavaScript
- stars
- 3
- watchers
- 1
- forks
- 1
- open issues
- 1
- Last updated
- 06/02/2021
Language: JavaScript
Rollup plugin to allow specification of 'input' array using globs, e.g. input:'./**/*.js'
Maintaining arrays of input files in the Rollup config requires additional thinking when adding a file to a site.
Wouldn't it be great if we could just set Rollup to look at a folder and run for every file that happens to be in there?
This plugin allows exactly that.
This plugin is not a way of specifying that multiple files should be merged into one file, for that the multientry plugin already exists.
Using npm:
npm install --save-dev rollup-plugin-folder-input*note: if you don't have Rollup installed yet, go do that first.
In the rollup.config.js file add
import { folderInput } from 'rollup-plugin-folder-input'
and make sure the plugin is added at the very start of your plugin list.
plugins: [ folderInput(), /* other plugins here */ ],
then you can use standard Globs in your input specification, e.g.
input: './src/*.js',
Create rollup.config.js with the following:
import { folderInput } from 'rollup-plugin-folder-input' export default { input: './src/*.js', plugins: [folderInput()], output: { dir: './dist', format: 'es', plugins: [] } }
Run from the command line with
npx rollup -c rollup.config.jsFor details on the glob format see the fast-glob documentation
Bug reports and pull requests welcomed - please be sure to include passing specification tests in any PR.
The tests are run using Jest and written in Jasmine style (describe/it) using ECMAScript modules.
A handy list of matchers is here: https://jestjs.io/docs/expect
npm run build - to build the librarynpm test - to run the tests and update the coverage reportTo view the code coverage report after running the tests open ./coverage/lcov-report/index.html in a browser.
See the Releases page for changelog for each release version.
This software is released under the terms of the MIT license.