BlessCSS/bless

Fix for import order on 3.0.x branches

eko opened this issue · 4 comments

eko commented

Hi,

We are currently using the latest version of grunt-agora-bless (0.2.2) which is using this library latest version as a dependency (agora-bless : 3.0.3).

We are splitting a CSS file into multiple parts in order to by-pass the IE limitation.

Issue is that our style.min.css file is written with the following (reversed / incorrect) import order:

@import url('style.min-blessed4.css');
@import url('style.min-blessed3.css');
@import url('style.min-blessed2.css');
@import url('style.min-blessed1.css');

This should be:

@import url('style.min-blessed1.css');
@import url('style.min-blessed2.css');
@import url('style.min-blessed3.css');
@import url('style.min-blessed4.css');

This is due to the following lines but I can't do a PR to fix that as there is no branch with the 3.x version: https://github.com/BlessCSS/bless/blob/v3.0.3/lib/bless/parser.js#L93-#L101

You have to replace with the following in order to fix this issue:

for (var k = filesLength; k >= 1; k--) {
    var outputFilename = filename + blessedFilenameSufix.replace('%d', ((k + blessedFilenameCounter) != 0 ? (k + blessedFilenameCounter) : '')) + ext;
    if (options.cacheBuster) {
        outputFilename += cacheBuster;
    }
    var importStr = '@import url(\'' + outputFilename + '\');';
    importStr = options.compress ? importStr : importStr + '\n';
    rules.unshift(importStr);
}

Can you please put this fix that in all 3.0.x tags or create a branch in order for me to fix this issue?

Thank you for your help and this work on this repository!

Hi @eko!

I created a branch called 3.x based off of the commit for v3.0.3

Based on #80 I'm not entirely sure that there's an issue here. @eko would you agree?

eko commented

@paulyoung, I think you're right, no issue in here, we can close.

@eko appreciate you looking into it.