The Rollup Relink Plugin copies static assets as required from your JavaScript code to the destination folder and adjusts the references in there to point to the new location.
The plugin is meant as a tool for preparing a library for being published. In this it differs from plugins like Rollup URL Plugin as it is designed for usage in libraries and not for applications. The output of this plugin can be used by tools like Webpacks File Loader, URL Loader or the already mentioned Rollup URL Plugin.
Features
- Copies over asset files references from JavaScript into the given output folder.
- Adjust asset references in the output JavaScript files to map to the relative new location.
- Transforms CSS files to inline all includes from
@import
via PostCSS Smart Import into the origin files. - Renames all assets based on their hash (SHA256 + Base62) so that conflicts are automatically eliminated while producing a flat zero depth output structure.
- Supports normal CSS, but also SugarSS and SCSS via the standard PostCSS parser plugins.
- Processes all files which do not match this extension list:
.json
,.jsx
,.js
,.es
,.es5
,.es6
,.vue
.
Links
Installation
$ npm install --save-dev rollup-plugin-relink
Usage
Rollup Relink comes with a binary which can be called from within your scripts
section
in the package.json
file.
const outputFolder = "./lib";const relink =
Contributing
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.
- Pull requests must be accompanied by passing automated tests (
$ npm test
).
License
Copyright
Copyright 2016
Sebastian Software GmbH