New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

acetate-asset-revisions

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acetate-asset-revisions

Use versioned assets with Acetate for cache-busting.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Acetate Asset Revisions

npm travis

Use versioned assets with Acetate for cache-busting.

Install

npm install acetate-asset-revisions --save-dev

Usage

// in acetate.conf.js
var assetRevisions = require('acetate-asset-revisions')

module.exports = function(acetate){
  acetate.use(assetRevisions({
    manifest: 'build/assets.json'
  }));
};

The manifest option should be the path to a JSON file that maps orginal source names to versioned assets. Most build systems have a way to accomplish this including gulp-rev, grunt-filerev and hashmark for command-line users.

You will then have access to serveral helpers to use in your templates:

  • {% css 'path/to/css.css'%}
  • {% js 'path/to/js.js'%}
  • {% img 'path/to/img.jpg' 'alt text'%}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">

    <!-- will lookup css/style.css in your manifest and use the versioned URL -->
    {% css "css/style.css" %}
  </head>
  <body>
    <!-- will lookup js/main.js in your manifest and use the versioned URL -->
    {% js "js/main.js" %}
  </body>
</html>

You can pass any additional HTML attributes you want as options.

  • {% css "css/style.css", media="print" %} - for standard string attributes use a key/value pair
  • {% js "js/main.js", async=true %} - for boolean attributes pass true as a value

Complete Examples

YOu can look at how to integrate Acetate and asset versioing into a complete build system in these samples:

Assumptions

This project makes several assumptions about your project structure. Your manifest file must be a simple JSON file that maps original filenames to their versioned file names.

{
  "css/style.css": "css/style-098f6bcd.css",
  "js/main.js": "js/main-273c2cin.js"
}

The path to this manifest file is assumed to be relative to your Acetate build folder.

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC

Keywords

FAQs

Package last updated on 21 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