Skip to content

Instantly share code, notes, and snippets.

@adi518
Last active December 15, 2020 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adi518/c6fc67e6d5b29c792da8ff50034df1e3 to your computer and use it in GitHub Desktop.
Save adi518/c6fc67e6d5b29c792da8ff50034df1e3 to your computer and use it in GitHub Desktop.
// https://github.com/postcss/postcss-plugin-boilerplate/
const CryptoJS = require('crypto-js');
module.exports = (_opts = {}) => {
return {
postcssPlugin: 'content-hash',
Root(root, _postcss) {
const contentHash = CryptoJS.MD5(root.source.input.css);
root.prepend({ text: `content-hash:${contentHash}` });
},
};
};
module.exports.postcss = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment