Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-external-assets

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-external-assets

A rollup plugin to make assets external but include them in the output.

  • 2.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
increased by67.82%
Maintainers
1
Weekly downloads
 
Created
Source

npm npm Build Status codecov MIT license

rollup-plugin-external-assets

A rollup plugin to make assets external but include them in the output.

:memo: Since library bundling is the primary use of this plugin, dynamic imports are not supported. Use at your own risk.

Installation

Via npm

npm install --save-dev rollup-plugin-external-assets

Via yarn

yarn add -D rollup-plugin-external-assets

Usage

import nodeResolve from "@rollup/plugin-node-resolve";
import externalAssets from "rollup-plugin-external-assets";

export default {
	input: "src/index.js",
	output: {
		file: "dist/index.js",
		format: "es",
		sourcemap: true,
	},
	plugins: [
		nodeResolve(),
		externalAssets("assets/*.png"),
	],
};

API

function externalAssets(pattern: string | RegExp | (string | RegExp)[]);

pattern

string | RegExp | (string | RegExp)[]

A picomatch pattern, or array of patterns, which correspond to assets the plugin should operate on.

// Operate on images located in the ./assets directory.
externalAssets("assets/**/*.jpg");

// Operate on images located in the ./assets directory.
// and all stylesheet files.
externalAssets(["assets/**/*.{jpg,png}", /\.(css|scss)$/]);

Contributing

Prerequisites

  • nodejs
  • npm

Getting Started

After cloning this repo, ensure dependencies are installed by running:

npm install

Then to build the final bundle:

npm run build

Tests

To run tests:

npm test

Note that rollup may emit warnings for unspecified options, or for some other reasons. I made sure they are ignored with the no-rollup-warnings flag in the npm test script.

If you want to see all the warnings when running tests, use this command instead:

npm run test:warn

Coverage report is located in tests/coverage. You might want to review it in your browser, and for example, write tests for non-covered blocks, or remove them if they're useless.

To run tests and update snapshots:

npm run test:update

or (with rollup warnings):

npm run test:update:warn

Commiting changes

Please follow the conventional commits specification, because semantic-release is used to automate the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.

License

MIT

Keywords

FAQs

Package last updated on 13 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc