-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@import inlining #47
Comments
Hi Santiago, Yes require-css currently relies on the optimizer to inline the imports as Guy On Thursday, February 28, 2013, Santiago Aguiar wrote:
|
I've included this in the latest version on the dev branch of the module. I'm still finalizing this 0.1 version, and will post a proper release out after more testing, but it should be fine to use in the mean time. |
Great! I'll test it out in a couple of hours and let you know, thanks for considering this! |
This is now in the master branch - please report if you have any issues. |
Sorry for the late reply! The change seems to work ok! I found a couple of issues: css-builder.js:
I assumed that was the intention. Otherwise css.js:
Otherwise the resource was still requested for download. After those two changes, things seems to be working wonderfully good :). |
Well caught - really appreciate your spotting these. This may well also resolve #56. In terms of moving forward with this cssBase property, I would value your opinion on requirejs/r.js#412 if you care to comment. |
I thought that the
Because, AFAIK, the css is resolved based on the About jrburke/r.js#412, I don't have a strong opinion, I agree that supporting / on import urls might be useful, though I always use relative URLs on my web projects to support deployment under different paths. I think that if you use '/' is because you expect a specific configuration on your environment, so it might be the case that the stuff you have on '/' is actually shared by multiple modules. But I'll agree that having '/' to mean "shared don't optimize" is a bit obscure ;). |
The reason I added cssBase is because in normal requires, But yeah I think relative imports is the best way forward - any module will typically know its "reverse distance" from the baseUrl, but at least the cssBase is supported anyway just in case someone needs it. |
Hi! I'm having some issues trying to flatten a CSS file that includes @imports (so that the imports get inlined with the CSS) and at the same time using require-css optimizer to inject the file in the JS.
The optimized JS file still includes the @imports directives, but I think it should either inline them, or even better, require them so that there's a single declaration of the imported CSS in the JS output.
Is this possible? I read something about @import handling on css.js, but that doesn't seems to be used when building, right?
I'm guessing that maybe this might work out of the box when r.js runs over an entire appDir, but I need to run it over the individual files, since the project folders contains other stuff which I don't want r.js to touch.
The text was updated successfully, but these errors were encountered: