-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Merged JS/CSS improvements #10
Comments
I love this: Added a separate base url for merged files vs media files. |
@colinmollenhour Integration with CDN is not foreseen in current implementation of Magento 2.x
That's true for Magento 1.x implementation, but Magento 2.x merging algorithm deliberately doesn't prepend any base URL to the references in CSS-files, so that all relative URLs remain relative after merging. Keeping relative URLs makes sense also when the merged CSS-file ends up uploaded to CDN, as long as the structure of related resources is maintained properly.
Sure, we'll take it into account. To get this done quickly, you have an opportunity to contribute a pull request with these improvements, compatible with Magento 2.x code base. We'd appreciate if the provided improvement is also covered with tests. Right now the model is covered by |
@mage2-team Thanks for considering my proposals. After I have become more familiar with Magento 2 and if I have time I will work on a pull request. While I see the merit of using domain-relative urls, I think it is better to keep the absolute urls in the CSS files and just generate separate CSS files for http and https because:
Consider these examples:
In this case with my proposal the merged url would be served from www.example.com but the skin images referenced in the CSS file should be loaded from Cloudfront. This really is a big deal since these CDNs simply are not 100% reliable (especially MaxCDN which is very popular) and if the merged JS or CSS file doesn't get loaded your site does not function. With relative URLs in the merged files you either have to have the css images loaded from the merged url or the merged files loaded from the skin url. Consider this case:
While I personally would avoid this configuration, I think it should be supported if possible. Using relative urls would break this case, methinks. |
Colin, thank you for describing the additional use cases. We'll make sure to take them into account when get to implementation of the CDN support. |
Just reading through this ticket. I'm wondering about some of the comments regarding not considering CDNs or multi-node environments? This is of course down to individual developer implementation but why would you create even a first release that has not considered the requirements of being run in a multi-node environment? I'm sure this is not the case but that is how some of the comments read. |
In Magento 1.x I made some improvements to Mage_Core_Model_Design_Package. Seems like now is a good time to suggest these for 2.0:
You can see my extended Package.php with these features here: https://gist.github.com/2364485
The text was updated successfully, but these errors were encountered: