url-version-resolver

0.1.1 • Public • Published

url version resolver

A mapping tool that takes the .json output from https://github.com/theasta/grunt-assets-versioning and given the original url returns the versioned url.

Could be used more generically. given an array of objects, will find the one where 'originalValue' matches the given value and will return a different specified property of the object

Installation

npm install url-version-resolver

Usage

var urlMap = require('./path/to/json.json');
var urlResolver = require('url-version-resolver')(urlMap);
var resolveUrl = urlResolver.resolveUrl;
var ajax = require('your-prefered-way-to-do-ajax');
var url = resolveUrl('/js/unversioned.js'); // returns '/js/versioned.js'

ajax(url, callback);

Package Sidebar

Install

npm i url-version-resolver

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • cwebbdesign