GithubHelp home page GithubHelp logo

isabella232 / rollup-plugin-rebase Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sebastian-software/rollup-plugin-rebase

0.0 0.0 0.0 5.08 MB

The Rollup Rebase 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.

License: Apache License 2.0

JavaScript 96.31% CSS 2.38% SCSS 1.31%

rollup-plugin-rebase's Introduction

Rollup Rebase
Sponsored by Version Downloads Build Status Unix Build Status Windows

The Rollup Rebase 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. It also respects assets referenced from your CSS/SCSS files.

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 Import into the origin files.
  • Detects and processes assets referenced from both, JavaScript and CSS.
  • Renames all assets based on their hash (XXHash + Base62) so that conflicts are automatically eliminated while producing a flat output structure.
  • Supports normal CSS, but also SugarSS, SCSS and Sass via the standard PostCSS parser plugins.

Comparison

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.

Installation

$ npm install --save-dev rollup-plugin-rebase

or

$ yarn add --dev rollup-plugin-rebase

Usage

You can configure Rollup Rebase as part of your Rollup configuration. This can be either done in a rollup.config.js or by scripting using the Rollup API:

import { rollup } from "rollup"
import rebasePlugin from "rollup-plugin-rebase"

async function config() {
  const bundle = await rollup({
    input: "./src/index.js",
    plugins: [rebasePlugin()]
  })

  await bundle.write({
    dest: "./lib/index.js"
  })
}

config()

Options (all optional)

  • assetFolder: When set assets are placed inside a sub folder with that name.
  • keepName: If true, generated filenames will be ${filename}~${hash}.${ext} instead of just ${hash}.${ext}
  • verbose: If true, increases log level
  • include: Standard include option for rollup plugins.
  • exclude: Standard exclude option for rollup plugins.

Copyright

Logo of Sebastian Software GmbH, Mainz, Germany

Copyright 2016-2020
Sebastian Software GmbH

rollup-plugin-rebase's People

Contributors

as-zlynn-philipps avatar bdwain avatar dependabot[bot] avatar lmoronil avatar swernerx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.