Skip to content

wilsson/postcss-url-versioner

Repository files navigation

PostCSS Url Versioner Build Status

PostCSS plugin url versioner.

/* Input example */
@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot');
  src: url('webfont.eot?#iefix') format('embedded-opentype'),
       url('webfont.woff2') format('woff2'),
       url('webfont.woff') format('woff'),
       url('webfont.ttf')  format('truetype'),
       url('webfont.svg#svgFontName') format('svg');
}

.myImage{
	background-image: url("/public/img/other/image3.png");
}
/* Output example */
@font-face {
  font-family: 'MyWebFont';
  src: url("webfont.eot?v=46cecf7");
  src: url("webfont.eot??v=46cecf7#iefix") format('embedded-opentype'),
       url("webfont.woff2?v=46cecf7") format('woff2'),
       url("webfont.woff?v=46cecf7") format('woff'), 
       url("webfont.svg?v=46cecf7#svgFontName") format('svg');
}

.myImage{
	background-image: url("/public/img/other/image3.png?v=46cecf7");
}

Usage

postcss([ require('postcss-url-versioner') ])

Options

postcss([ 
  require('postcss-url-versioner')({ 
    variable: 'version',
    version: Math.random()
  })
])

Default Options

{
	variable: "v",
	lastCommit: "46cecf7"
}

By default it takes abbreviated commit hash generated by json-last-commit.

If you want to place your own version use version property.

See PostCSS docs for examples for your environment.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published