New Zenner
- Join Date:
- Apr 2008
- Posts:
- 36
- Plugin Contributions:
- 0
Combining Stylesheets
Is it possible to combine stylesheets from add ons with the main stylesheet without causing any problems or major customization of the stylesheet?
New Zenner
Is it possible to combine stylesheets from add ons with the main stylesheet without causing any problems or major customization of the stylesheet?
Black Belt
Definitely possible.
Website speed optimization programs will even tell you that you should always do it, though there can be ease-of-use advantages to having separate files for discrete mods.
If a mod's styles extend or modify a distinct area of the main stylesheet, it would be good to merge it in that location so as to avoid overlapping or conflicting declarations; otherwise, you can always just add the contents of a mod stylesheet to the end of the main stylesheet.
New Zenner
so i could basically add them to the end of the stylesheet and put comments around the ones that go to certain mods so it is easier to see which styles apply to those mods. then of course I would have to go through the files of each mod and change the name of the style sheet.
Black Belt
No, you wouldn't have to change any stylesheet references in mod files. The mod doesn't know or care which stylesheet file the styles come from; any declarations that apply to the classes/ids in the mod are used by Zen Cart.
New Zenner
so why don't the people that make the mods just add on to the main stylesheet of zen cart?
Totally Zenned
fsicody:
so why don't the people that make the mods just add on to the main stylesheet of zen cart?
... because the stylesheets are one of the most "customizable" aspects of the program... they don't know how or where users have modified their stylesheet, and in order to provide a (relatively) easy way of making comparisons between a mod stylesheet and the user's stylesheet, keeping things separate makes sense.
As indicated, there is nothing wrong with "blending" stylesheets, as long as there is a good understanding of how stylesheets behave (chronology, structure, order, etc).
New Zenner
would it make a big difference as far as load time to combine the stylesheets?
Black Belt
It would probably not make a noticeable difference... depending on the current behavior of your cart. If it loads slowly even for users with a fast connection, then every little thing is worth trying.
New Zenner
What is the best way to merge stylesheets?
Totally Zenned
gjh42:
It would probably not make a noticeable difference... depending on the current behavior of your cart. If it loads slowly even for users with a fast connection, then every little thing is worth trying.
This may not be correct in all cases, it does make noticeable difference especially on sites where a large number of css and js files are used.
CJ Loader will help you to do the task:
http://blog.rubikintegration.com/2009/08/08/zencart-css-javascript-loader-released/
I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me
Tell staff why this post should be reviewed.