Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uppercod/rollup-pack
https://github.com/uppercod/rollup-pack
Last synced: about 3 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/uppercod/rollup-pack
- Owner: UpperCod
- Created: 2019-06-06T00:18:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T12:28:32.000Z (almost 2 years ago)
- Last Synced: 2023-03-05T17:34:09.465Z (over 1 year ago)
- Language: JavaScript
- Size: 166 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rollup-pack
This is a bundle prefiguration for [Rollup](https://rollupjs.org) that allows to generate code for the browser in MJS format and to know its cost in size.
The process is simple and is done thanks to [@atomico/rollup-plugin-input-html](https://github.com/atomicojs/rollup-plugin-input-html)
1. the existing html files in the root are analyzed.
2. it extracts the local script of the modules type, from the html files.
3. Bundles are generated for each one based on the name of the HTML file. eg: `ui-button.html` will be `ui-button.js`.through the process 2 bundle directories are generated:
1. `./dist`: copy the html and all its dependencies thanks to [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve) and [@atomico/rollup-plugin-input-html](https://github.com/atomicojs/rollup-plugin-input-html).
2. `./lib` : copy alone the js of export.In both formats the cost of each bundle is taught thanks to [@atomico/rollup-plugin-sizes](https://github.com/atomicojs/rollup-plugin-sizes).
## Use
```js
import pack from "@atomico/rollup-pack";export default pack("*.html" /**,optionalConfig **/);
```## default configuration
```js
let ignoreLog = ["CIRCULAR_DEPENDENCY", "UNRESOLVED_IMPORT"];let defaultOptions = {
dirDist: "./dist",
dirDemo: "./lib",
minifyDist: !isDev,
minifyDemo: !isDev,
showSizes: !isDev,
plugins: [],
pluginsDist: [],
pluginsDemo: [],
onwarn(message) {
if (ignoreLog.indexOf(message.code) > -1) return;
console.error(message);
}
};
```## By default the configuration works thanks to the plugins.
1. [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve)
2. [rollup-plugin-terser](https://github.com/TrySound/rollup-plugin-terser)
3. [@atomico/rollup-plugin-input-html](https://github.com/atomicojs/rollup-plugin-input-html)
4. [@atomico/rollup-plugin-sizes](https://github.com/atomicojs/rollup-plugin-sizes)