Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/rev-path
Create a revved file path
https://github.com/sindresorhus/rev-path
Last synced: about 1 month ago
JSON representation
Create a revved file path
- Host: GitHub
- URL: https://github.com/sindresorhus/rev-path
- Owner: sindresorhus
- License: mit
- Created: 2015-05-22T20:51:59.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2022-07-09T03:34:28.000Z (over 2 years ago)
- Last Synced: 2024-04-14T06:09:33.041Z (7 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 20
- Watchers: 8
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Security: .github/security.md
Awesome Lists containing this project
README
# rev-path
> Create a [revved file path](http://blog.risingstack.com/automatic-cache-busting-for-your-css/)
## Install
```sh
npm install rev-path
```## Usage
```js
import {revPath, unrevPath} from 'rev-path';const hash = 'bb9d8fe615'
const path = revPath('src/unicorn.png', hash);
//=> 'src/unicorn-bb9d8fe615.png'revPath('src/unicorn.png', Date.now());
//=> 'src/unicorn-1432309925925.png'// You can also revert an already hashed path
unrevPath(path, hash);
//=> 'src/unicorn.png'
```## Related
- [rev-file](https://github.com/sindresorhus/rev-file) - Get the revved file path of a file