Josiah / gulp-cachebust

Generates checksums and renames references to files, useful for cachebusting
30 stars 11 forks source link

Fixing the path mapping issue for windows which uses backslash. #11

Closed zumesh20 closed 9 years ago

zumesh20 commented 9 years ago

While running cachebust on windows environment, it creates mapping with original and cachebusted resources but uses backslash in the key as well as value. Since most of the CSS and javascripts refer the references using forward slash in the path, replacement fails. Ex - The mapping created on windows for resources

{
    'background.png': 'background.d09952e7.png',
    'connect_logo.svg': 'connect_logo.ed8082c7.svg',
    'icons\ic_hamburger.svg': 'icons\\ic_hamburger.acc70e35.svg',
    'icons\ic_person_outline_24px.svg': 'icons\\ic_person_outline_24px.4ec40b8e.svg',
    'icons\ic_search_24px.svg': 'icons\\ic_search_24px.0cbd1d7d.svg'
}

In CSS, the image being referred as

  background: url("../images/icons/ic_hamburger.svg") center center no-repeat;

Slash makes the path consistent and hence generates the correct mappings

{
    'background.png': 'background.d09952e7.png',
    'connect_logo.svg': 'connect_logo.ed8082c7.svg',
    'icons/ic_hamburger.svg': 'icons/ic_hamburger.acc70e35.svg',
    'icons/ic_person_outline_24px.svg': 'icons/c_person_outline_24px.4ec40b8e.svg',
    'icons/ic_search_24px.svg': 'icons/ic_search_24px.0cbd1d7d.svg'
}
zumesh20 commented 9 years ago

I have updated the pull request.

zumesh20 commented 9 years ago

Can you please create a new release after these changes?