-
Notifications
You must be signed in to change notification settings - Fork 1.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
CSS module loads out of order #1680
Comments
Thanks. The problem here is: custom css modules should load after any YUI related css files. This is a feature that was done purposely, it seems. That's why I missed it in the modifications I've made. |
Interesting, I always thought the order of the modules listed in Y.use or a requires array was significant. I see you're right though. In my JS bin example, with YUI 3.14.1 if I reverse the order of the requires array, the custom CSS module still loads after the datatable skin. If I use another CSS module like |
@solmsted just for the record, the order of the We happen to have that sort of a hack to put the core css modules first if not explicit dependencies are in place. |
This has been "fixed" in #1743. However, Loader is now a bit stricter with the order in which it'll load your CSS modules. As of So, your example would have to change to: YUI({
combine: false,
groups: {
'my-group': {
modules: {
'my-custom-css': {
fullpath: '/path/to/css',
type: 'css',
// we want this module to load after everything datatable
requires: [
'datatable'
]
},
'my-custom-module': {
fullpath: '/path/to/module',
requires: [
'my-custom-css'
]
}
}
}
}
}).use('my-custom-module', function () {}); |
@ezequiel Thank you very much. It was a good choice to remove the logic that loads CSS modules first regardless of the order defined in the config. I just tried my jsbin example with YUI 3.16.0-rc-1. It works as expected without having to make the changes you've suggested. It already specifies the order I really want in the requires array of my-custom-module. I hope that this isn't just a coincidence and that the ordering of requires arrays are still significant; I rely on the order of these arrays for many of my modules, not just CSS. @caridy pointed out that the order of arguments passed to YUI's |
@solmsted that will be ambiguous, there are many other rules that are equivalent to |
I recently updated one of my applications in development to YUI 3.15.0 from 3.14.1 and suddenly my CSS is loading out of order.
I've created an example in JS bin: http://jsbin.com/hafibawa/1/edit?html,js,output
This example loads a custom module that requires datatable and a custom css module. Since datatable is first in the requires array, I would expect all of datatable's skin css to load before the custom css module.
After running the code, I can inspect the dom and see that the link element for the custom css module is before the link elements for the datatable skin css.
Here is an example of the same thing using YUI 3.14.1: http://jsbin.com/hafibawa/2/edit?html,js,output
Here the CSS is loaded in the correct order.
The text was updated successfully, but these errors were encountered: