scniro/gulp-clean-css

Rebase doesn't work on files outside the Gulp workspace

Closed this issue · 5 comments

When processing files that are located outside the folder that your gulpfile.js is located:

return gulp.src(
[
'../base/fontawesome/css/font-awesome.css'
... etc ... etc
])
.pipe(cleanCss())
.pipe(gulp.dest('../default/css.dev/'));

The rebase function doesn't work. The above CSS example file contains:

  src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');

That URL should be rebased to:

  src: url('../../base/fontawesome/fonts/fontawesome-webfont.eot?v=4.7.0');

But it is not, the path seems to remain untouched.

are you passing any of the rebaseTo options to your function call? I am not seeing anything passed per your usage of .pipe(cleanCss())

I tried a myriad of rebaseTo values, both absolute and relative.

I was unable to figure out how the function was creating the final URL path.

The best it seemed to do was output this:

src: url('../../fonts/fontawesome-webfont.eot?v=4.7.0');

e.g. just adding another ../ in front.

I've ended up using a dedicated rebasing plugin gulp-css-url-rebase

I have revisited this and hope the newest changes will resolve this. Please pull down 3.1.0 and let me know if this meets your expectations. Thanks!

Nice, I'll give it a shot 😀

Did some more work on this as seen at clean-css/clean-css#937 and all should be fixed with the 3.2.0 release. I am going to close this for now, but please reply here or open up a new issue should you still encounter issues. Thank you!