OverZealous / gulp-cdnizer

A gulp plugin for replacing local links with CDN links, includes fallbacks and customization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

possibility to add a revision number to cdn path

vdclouis opened this issue · comments

something like:

files: [
  {
    file: 'scripts/all.js',
    cdn: '//static.cdn.url/scripts/all.js?v=098f6bcd'
  }
]

To clarify, are you wanting the REV hash from the embedded file available to templates? You can easily do this by specifying your own custom template.

For example, if the original file in your HTML was /scripts/all.js?v=098f6bcd, your template could be:

{
    file: 'scripts/all.js*', // note the * to match anything after the filename
    cdn: '//static.cdn.url/${ filepathRel }'
}

As long as you add the revision number first, it will be included in the result.

Also, this probably will work just fine with ${ filename }, since the path module will leave the ?v=....

thanks man, works great!