konitter / gulp-combine-media-queries

MIT License
92 stars 28 forks source link

Bug with url @import #3

Closed DarkPreacher closed 10 years ago

DarkPreacher commented 10 years ago

Hi! There is a bug with @imports. Example file style.less:

@import url(http://fonts.googleapis.com/css?family=Titillium+Web:600);

and nothing happens, output is empty.

Gulp task I'm using:

gulp.task('style', function () {
    gulp.src(source.css + '/style.less')
        .pipe(less({ sourceMap: true }))
            .on('error', gutil.log)
            .pipe(gulp.dest(assets.css))
            .pipe(browserSync.reload({ stream: true }))
        .pipe(rename({ suffix: '.min' }))
        .pipe(less())
            .on('error', gutil.log)
        .pipe(cmq())
        .pipe(csso())
            .pipe(gulp.dest(assets.css))
});

In style.css @imports exists, but in style.min.css @imports ripped out. If I comment .pipe(cmq()) — @imports comes back.

4rn0 commented 10 years ago

I have the same problem. Any chance of fixing this?

didoo commented 10 years ago

Same for me. @konitter if you look at the Grunt version (https://github.com/JohnCashmore/grunt-combine-media-queries/blob/master/tasks/combine-media-queries.js) you are missing these:

// Process media queries
var processImportURL = function(importURL) {
var strCss = '';
strCss += '@import ' + importURL.import + ';';
return strCss;
};

// Function to import URL
var outputImportURL = function(importURL){
importURL.forEach(function(item){
strStyles += processImportURL(item);
});
};

// Check if import URL was processed
if (processedCSS.importURL.length !== 0){
outputImportURL(processedCSS.importURL);
}

Do you think is something you can fix?

geibi commented 10 years ago

copy that. it would be really nice if you could apply the fix

didoo commented 10 years ago

@konitter it would help if I prepare a fix it, and then do a pull request? would you merge my changes in the master branch then? I am absolutely not an expert of Gulp plugins, and it would take me some time, but if this could solve the problem...

garand commented 10 years ago

Same problem here. Looking forward to a fix. :+1:

geibi commented 10 years ago

thanks for the merge. everything seems good now :)