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

html-bust

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-bust

Cache-busts URLs in HTML files

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

html-bust

Cache-busts URLs in HTML files by appending a query string with a hash of the referenced resources. Similar to grunt-cache-bust, but runs on its own.

Because parsing and re-marshaling HTML documents is brittle, URLs are replaced through regular expressions. As a way to mitigate against unwanted substitutions, URLs that are to be busted can be marked with a special suffix.

Usage

var bust = require('html-bust');
bust(inPath, outPath, [options], [done])

Rewrites the HTML file inPath to outPath, cache-busting URLs by appending a query string with a hash of the referenced resource. Relative URLs are resolved against the location of the HTML file; absolute URLs are ignored.

Available options:

  • tagTypes (default: [ 'img', 'script', 'link' ])

    An array of HTML tag types to cache-bust. Currently, img, script and link are supported. Tags of other types are ignored.

  • urlHint (default: '?bust')

    If set to a string, only URLs ending with that string are busted. The string is removed from the processed HTML file. If null, URLs are busted inconditionally.

  • mode (default: hash)

    One of hash or string. In hash mode, references are busted with a hash of the respective file contents, according to the hashAlgorithm and hashString options. In string mode, references are busted with the fixed string given by the fixedString option.

  • hashAlgorithm (default: 'sha1')

    The hash algorithm to use in hash mode. Check the documentation for crypto.createHash.

  • hashLength (default: 8)

    The number of hash characters to use in hash mode as the cache-busting string.

  • fixedString (default: '')

    The fixed string to use in string mode.

Keywords

FAQs

Package last updated on 12 Apr 2015

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