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

broccoli-asset-rewrite

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-asset-rewrite

broccoli plugin to rewrite a source tree from an asset map.

  • 1.0.12
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is broccoli-asset-rewrite?

The broccoli-asset-rewrite npm package is used to rewrite asset URLs in your files. This is particularly useful in build processes where you need to update the paths to assets like images, fonts, and other resources to match the structure of your output directory.

What are broccoli-asset-rewrite's main functionalities?

Basic URL Rewriting

This feature allows you to rewrite URLs in specified file types (e.g., HTML, CSS) by prepending a base URL. This is useful for serving assets from a CDN.

const BroccoliAssetRewrite = require('broccoli-asset-rewrite');

let tree = new BroccoliAssetRewrite(inputTree, {
  replaceExtensions: ['html', 'css'],
  prepend: 'https://cdn.example.com/'
});

Custom Replace Function

This feature allows you to provide a custom replace function to modify URLs in a more flexible way. For example, you can change '/assets/' to '/static/' in your URLs.

const BroccoliAssetRewrite = require('broccoli-asset-rewrite');

let tree = new BroccoliAssetRewrite(inputTree, {
  replaceExtensions: ['html', 'css'],
  replace: function(url) {
    return url.replace('/assets/', '/static/');
  }
});

Exclude Specific Files

This feature allows you to exclude specific files from the URL rewriting process. For example, you can exclude 'index.html' from being processed.

const BroccoliAssetRewrite = require('broccoli-asset-rewrite');

let tree = new BroccoliAssetRewrite(inputTree, {
  replaceExtensions: ['html', 'css'],
  exclude: ['index.html']
});

Other packages similar to broccoli-asset-rewrite

Keywords

FAQs

Package last updated on 18 Jun 2016

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