-
Notifications
You must be signed in to change notification settings - Fork 66
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
controlling load order of stylesheets #1324
Comments
legacy definitely MUST come after. It needs to provide legacy override of bootstrap. Same for core.css I believe. |
the bigger problem is the |
Isn't this a blocker then ? Since loading reset after the rest can really mess up the layout . I was checking PageUtil in Zikula Core 1.3.6 and there is around line 329
In Core 1.3.7 it is https://github.com/zikula/core/blob/1.3/src/lib/util/PageUtil.php#L350 Several comments on the PHP page are interesting, I think the foreach way will not mess up the order, but only remove the duplicates. But the array_flip method is quite elegant
and substantially faster than array_unique as it seems, which for us is not that important, since it's usually only a small array, but speed gain is speed gain. @rgash can you test if that helps in your case ? |
As suggested also in this topic http://community.zikula.org/index.php?module=Forum&func=viewtopic&topic=59641&start=0 it might be an idea to add a weight or priority to the pageaddvar call. So that certain parts can always be loaded with high prio and others with lower or default prio |
This seems really broken in 1.3.5/6: If I look at the order to style sheets loaded under Andreas08 then I get this: <link rel="stylesheet" href="style/core.css" type="text/css" />
<link rel="stylesheet" href="modules/ZWebstore/style/style.css" type="text/css" />
<link rel="stylesheet" href="system/Admin/style/style.css" type="text/css" />
<link rel="stylesheet" href="modules/ZWebstore/style/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="modules/ZWebstore/style/bootstrap-custom.css" type="text/css" />
<link rel="stylesheet" href="modules/ZWebstore/style/jquery.tipTip.css" type="text/css" />
<link rel="stylesheet" href="themes/Andreas08/style/fluid960gs/reset.css" type="text/css" />
<link rel="stylesheet" href="themes/Andreas08/style/fluid960gs/grid.css" type="text/css" />
<link rel="stylesheet" href="themes/Andreas08/style/style.css" type="text/css" /> Removing the array_unique() calls has no effect on the order, so it seems that this is just the result of the order in which the relevant sections are loaded/processed. It would be easy to fix this for Andreas08, but a general solution will require some changes in the way this is handled. IMHO, a priority setting would be good, although it might suffice to simply order the priorities based on the section from which a certain CSS is loaded:
Right now it almost seems that things are backwards, i.e.: that theme CSS is added last when in fact it should be added first. |
Just to add, if you do a pageaddvar via a module to load jQueryUI/jQuery for instance where this is normally not loaded. Then it would be nice if that would not load last, but also somewhere in front. If the theme does not load it already. |
Well, if we assume that each section (see above for sections 1,2,3,4) loads it's stylesheets (and JS) in the correct order (and that would seem a safe assumption), then a simple duplicate check will get rid of that problem. So if your theme (or core) loads jQuery and the module attempts to load jQuery as well, then the module load command should be ignored. This would however mean that we need some kind of component key (ex: 'jQuery' for jQuery) since the actual files we're attempting to load might not have the same path, filename, etc.. This is how some other systems (WP, Typo3, etc) do it and it's a smart thing to do since it avoids loading multiple versions of the same file (or multiple versions of different versions of the same component). |
jQuery is loaded by default all the time in Core 1.3.7 atm. as is Bootstrap because both are integral to the core. |
That's great news, but lets make sure that we don't have the same mess in The problem though remains that this is seriously broken in 1.3.6 and On Sun, Dec 15, 2013 at 1:21 PM, Craig Heydenburg
|
I disagree. Theme is last because it's the place for the site's customization. |
I agree with @matheo wrt order - this is what I posted in the referenced forum post:
this is much harder than you might think however to control from what I can see. |
from reading the discussions, it would seem that the entire methodology is flawed - that is, having random modules attempting to control the environment and vie for dominance. We need a better strategy for the long term. |
agreed. I believe that the theme is the bigger issue though in terms of vying dominance. perhaps stylesheets and site-wide js could be 'registered' via an event or something (dependency injection?) and then managed with some intelligence but ultimately configurable via some admin interface... |
I'll tell you my thoughts based on the difficulties I have been having integrating our way of doing things into Twig, Assetic and Symfony. (hint: I am working on an end-game prototype). Under our paradigm we have modules making output, then we have the theme which is a completely separate entity which uses module output as a variable. Top that of with random blocks. The theme is the dominant factors (leaving aside from custom config level overrides). The only say a module has over the theme is to prevent a theme from loading at all (by returning In Symfony's paradigm of course, developing single applications, bundles will simply extend a base theme template thus the module's output and the theme are in fact the same template. If the bundle chooses, it can extend any base template it chooses - doesnt have to be the system wide theme. This is problematic for us because we have systems with multiple themes. But multiple themes are still a problem because it takes power away from modules. We make assumptions about which theme to use based on random stuff like What we have are contracts that modules need to follow (like using certain style-sheet conventions) and assumptions that all modules talk to each-other (when actually they cant) - so what actually evolved over time are modules that are coupled to each other's paradigm. The fact is you cant really have independent modules (or blocks). So what we have now is the core which forces certain sheets/js and modules/theme registering their own all making assumptions. Ultimately it's quite possible a block and a module conflict with each other. Not to mention script order. So basically we have a theme which is supposed to be the leader, except we hack it in multiple cases (like ajax requests) to not display at all. We have to couple the theme to individual module templates if we want to do something radical, thus creating coupling to modules. So what if someone releases a new module that also needs that radical styling - you are suddenly stuck until the theme author updates it or you have the savvy to update it yourself. Clearly the whole "generic theme" concept is quite flawed. If Zikula is more like a web developer tool - that's fine, but if so then there need to be more programmatic ways of securing what you want. Otherwise, some kind of registry as @craigh says, but that could be a performance hog - somehow, Maybe some kind of hard values in the theme - but then you have to configure per theme. It would make module installation complex. I don't really know... but these are my thoughts. We need a solution. |
should this be bumped to 1.5.0? |
Yes, we should think about it together with #1753 |
I think the order is ok. imho it should be like it is:
If reset.css is still useful then lets add it to the core. But do we really still need reset.css? Does not bootstrap do this job? |
I think we should deprecate the use of reset.css, since Bootstrap does what we need. |
remember, 1.4.0 is a BC release and as such, all current 1.3.x modules should look the same in 1.4.0 |
The question is more what is reset.css doing? If I understood it right it sets default css values, which are different in mozilla, chrome, explorer, .... But I think that bootstrap is doing that as well. |
Bootstrap uses normalize.css, so reset.css is not needed. |
cool. so remove it locally and start testing 😉 |
Sorry, I think this order is not good. IMHO it should be:
or
Either way, IMHO module should be last. On Mon, Jun 23, 2014 at 8:50 PM, phaidon [email protected] wrote:
|
As was discussed earlier in this ticket, the Theme should be last as it is the place for customization. |
Please keep the order as:
|
this is the current load order in dizkus at the ntq site
is this right? |
@Guite do you think this should be closed yet? |
I think it should be reviewed in 1.5 wrt Twig and Drak's comments above. |
I changed the milestone to 1.5 |
This ticket is closed with the implementation of an asset weighting system which can be used to control the load order of either stylesheets or javascripts in #2606. |
The load order of css stylesheets is buggy I believe. With the new "auto-loading" of assets from the
/web
directory, the order seems not to be correct or reliable. Somehow the order must be controlled so that classes override appropriately.In Dizkus right now, the is the order:
IMO, the
core.css
andlegacy.css
should probably load beforebootstrap.min.css
andfont-awesome.min.css
but the bigger problem is that the themereset.css
overrides many items inbootstrap.min.css
and causes problems.Anyway - I don't really understand how css load order works exactly, so I cannot solve this and it seems broken but maybe I just don't understand. Can someone with the knowledge and skill take a look?
@cmfcmf @phaidon @jusuff @rojblake
The text was updated successfully, but these errors were encountered: