1.0.5 • Published 7 months ago

postcss-url-version v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

postcss-url-version

GitHub issues GitHub license

Twitter

Postcss-url-version is a simple PostCSS plugin that adds a hash on every url property.

Usage

install it:

npm i -D postcss-url-version

Include it in your scripts:

const UrlVersion = require('postcss-url-version');

Use as any other PostCSS plugin:

Postcss([Autoprefixer, UrlVersion])...

Options

There are 2 options, version and variable:

  • version a function that returns a string for the hash
  • variable could be a a string denoting the URLparam that will be used for the version

eg:

const UrlVersion = require('postcss-url-version');
const versioned = UrlVersion({
  // The path of the asset relative to the css is passed as argument to the function,
  // so you can hash the content of the file for a better invalidation strategy
  version: (path) => new Date().valueOf().toString(),
  variable: 'v',
});
Postcss([versioned])...

// Will produce something like url("https://mdn.mozillademos.org/files/16761/star.gif?v=1614866396902");

License MIT

1.0.5

7 months ago

1.0.4

7 months ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago