scniro/gulp-clean-css

URL rebasing is broken

Closed this issue · 4 comments

URL rebasing got broken / changed between versions 2.0.6 ->2.2.0
Basically I use CSS files from multiple places in '/public/src' path and I minimize content and put it into 'public/out' folder. Unfortunately URLs are being rebased differently after version change.

Version 2.0.6 URL output: 'background:url(../src/elements/dj-menu-top/images/image.jpg)'
Version 2.2.0 URL output: 'background:url(../../../../elements/dj-menu-top/images/image.jpg)'

My gulp task

var OUTPIT_FOLDER_PATH = './public/out';
var IMPORT_STYLES = [
	"./public/src/elements/dj-nprogress/stylesheets/nprogress-wj.css",
	"./public/src/elements/dj-drawer/stylesheets/main.css",
        // There are multiple styles
];

var concatCss = require('gulp-concat-css');
var cleanCSS = require('gulp-clean-css');

gulp.src(IMPORT_STYLES)
        .pipe(concatCss('styles-' + versionNumber + '.min.css', {rebaseUrls: true}))
        .pipe(cleanCSS({ relativeTo: './public/out/', target: './public/out/', rebase: true }))
        .pipe(gulp.dest(OUTPIT_FOLDER_PATH));

Can you elaborate? Perhaps share the current output and let me know of the expected output? There were some changes that probably impact this, could be helpful to check out #22 and #8.

I updated my initial message.

did you look at the issues I referenced? I'm guessing you need to change your options, specifically, relativeTo and target

I will get around this, no problem. I submitted this issue because to me it looks like a bug that breaks projects that depends on your plugin and require users to change parameters for no benefit. I guessed you might be not aware about it and might want to fix it. If you think though it's somehow improvement or just don't care, than please close this issue.