Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not replacing parent directory relative paths #23

Closed
joshbaronmc opened this issue Apr 4, 2016 · 1 comment
Closed

Not replacing parent directory relative paths #23

joshbaronmc opened this issue Apr 4, 2016 · 1 comment

Comments

@joshbaronmc
Copy link

Hi,

Thank you for creating gulp-cdnizer. I am having an issue with replacing CSS url() that have a parent directory relative path. My directory structure is:

build/dist/styles/default.style.css
build/dist/images/*

My gulp task is:

gulp.src(args.dest + 'styles/default.style.css')
            .pipe(cdnizer([
                {
                    relativeRoot: 'dist/',
                    file: '**/*.png',
                    cdn: 'my.cdn/images/${ filename }'
                }
            ]))
            .pipe(gulp.dest(args.dest + 'styles/'));

In my CSS, I have:
background-image: url(../images/sprite.png);

CDNizer will not replace the ../images/sprite.png. If I change my CSS to (use current directory relative path instead of parent directory relative path):

background-image: url(./images/sprite.png);

It works. So, for some reason CDNizer will not replace CSS URLs that have ../ but does work for URLs that have ./

Any ideas on how I can get CDNizer to replace URLs in CSS that have relative parent directory paths like background-image: url(../images/sprite.png)?

Thanks!

@OverZealous
Copy link
Owner

Please report issues with cdnizer against that repo, this repo is only for the gulp plugin.

This is a known issue, and I don't have a general fix for it at this time. Minimatch (which is being used for pattern matching) doesn't work with relative paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants