Socket
Socket
Sign inDemoInstall

broccoli-asset-prepend

Package Overview
Dependencies
86
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    broccoli-asset-prepend

broccoli asset prepending (rewrite assets references)


Version published
Weekly downloads
14
decreased by-26.32%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

broccoli-asset-prepend

Broccoli plugin to add prepend asset references with a scheme + domain or root path.

Turns

<script src="assets/appname.js">
background: url('/images/foo.png');

Into

<script src="https://subdomain.cloudfront.net/assets/appname.js">
background: url('https://subdomain.cloudfront.net/images/foo.png');

Installation

npm install broccoli-asset-prepend --save-dev

Usage

var AssetPrepend = require('broccoli-asset-prepend');

var assetNode = new AssetPrepend(node, {
  assetExtensions: ['js', 'css', 'png', 'jpg', 'gif'],
  replaceExtensions: ['html', 'js', 'css'],
  ignore: ['testem.js'],
  prepend: 'https://subdomain.cloudfront.net/'
});

Options

  • prepend - Default: '' - A string to prepend to all of the assets. Commonly a CDN url like https://subdomain.cloudfront.net/
  • assetExtensions - Default: ['js', 'css', 'png', 'jpg', 'gif', 'map'] - The file types to prepend.
  • replaceExtensions - Default: ['html', 'css', 'js'] - The file types to replace source code with new checksum file names.
  • ignore - Default: [] - An array of paths to skip rewriting.
  • enableCaching - Default: true - If true, will set this options on broccoli-asset-rewrite
  • assetFileFilter - Default: a function always returning true - Asset files matching assetExtensions will be passed through this filter giving you the opportunity to exclude some assets. broccoli-asset-rewrite is slower with a larger assetMap, so this can be useful to optimize build times.
  • annotation - Default: null. A human-readable description for this plugin instance.

Default settings

The default settings are available if needed in your application or addon via: var broccoliAssetPrependDefaults = require( 'broccoli-asset-prepend/lib/default-options' );

Ember CLI addon usage

var app = new EmberApp({
  assetPrepend: {
    prepend: 'https://sudomain.cloudfront.net/'
  }
});

Ember CLI addon options

This addon runs in the postProcessTree hook.

See Options section above for explanations and defaults

  • enabled - Default: true - will skip entirely if false
  • prepend - Default: null - Required
  • assetExtensions
  • replaceExtensions
  • ignore
  • enableCaching
  • assetFileFilter

Credits

Thanks to broccoli-asset-rev for inspiration and to Precision Nutrition for sponsoring the work on this plugin.

Keywords

FAQs

Last updated on 27 Oct 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc