mariocasciaro / gulp-concat-css

Concatenates css files, bubbling up import statements (as per the standard), and optionally rebasing urls and inlining local import statements.
MIT License
78 stars 19 forks source link

Moving external @import to top of concatenated files #11

Closed jlukic closed 9 years ago

jlukic commented 9 years ago

I've integrated gulp-concat-css as part of the new build system for Semantic UI. I've noticed that external import statements, like Google Font import statements are not moved to the top of concatenated css files.

For example

@import url(http://fonts.googleapis.com/css?family=Open+Sans);

would stay in the same location that it was included in the concat (which could be anywhere in the file)

This causes the import statement to fail because @import statements must proceed all other rules

This would be a requested enhancement, I realize this feature is not currently supported.

mariocasciaro commented 9 years ago

It makes sense, let me see what I can do. Of course a PR is welcome if you already have a solution ready :)

mariocasciaro commented 9 years ago

Landed in 1.1.0

jlukic commented 9 years ago

Woah just rebuilt today and it worked like magic. Thanks so much! Using in build system here for Semantic UI 1.0

mariocasciaro commented 9 years ago

Perfect!

nsotnikov commented 9 years ago

Hello, have an error by integrating gulp-concat-css in my gulp.js

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Could not find a valid import path in string: @import url(http://fonts.googleapis.com/css?family=Open+Sans)
``
mariocasciaro commented 9 years ago

Try to wrap the url with quotes: @import url('http://fonts.googleapis.com/css?family=Open+Sans'). If this doesn't fix the problem, please open a separate issue so we can track it better.

john-henry commented 9 years ago

The issue I believe is the latest update of import-regex (1.1.0). Reverting to import-regex 1.0.0 allowed the build of Semantic UI 1.0.x to complete

https://github.com/Semantic-Org/Semantic-UI/issues/1299

The line causing the issue, if you are not familiar with Semantic UI is the following

@import (css) '@{googleProtocol}fonts.googleapis.com/css?family=@{googleFontRequest}';

mariocasciaro commented 9 years ago

I confirm there is a problem, I re-run the unit tests with up-to-date deps and it breaks.

mariocasciaro commented 9 years ago

Please follow issue #13 for updates.