Forums / Templates, Stylesheets, Page Layout / Combining Stylesheets

Combining Stylesheets

Locked

Started by fsicody on 17 Apr 2008, 4:38 PM · Views: 2,156

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
17 Apr 2008, 4:38 PM
#1
fsicody avatar

fsicody

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?

17 Apr 2008, 5:03 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Combining Stylesheets

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.

17 Apr 2008, 5:11 PM
#3
fsicody avatar

fsicody

New Zenner

Join Date:
Apr 2008
Posts:
36
Plugin Contributions:
0

Re: Combining Stylesheets

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.

17 Apr 2008, 5:36 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Combining Stylesheets

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.

17 Apr 2008, 5:37 PM
#5
fsicody avatar

fsicody

New Zenner

Join Date:
Apr 2008
Posts:
36
Plugin Contributions:
0

Re: Combining Stylesheets

so why don't the people that make the mods just add on to the main stylesheet of zen cart?

17 Apr 2008, 5:49 PM
#6
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Combining Stylesheets

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).

17 Apr 2008, 5:57 PM
#7
fsicody avatar

fsicody

New Zenner

Join Date:
Apr 2008
Posts:
36
Plugin Contributions:
0

Re: Combining Stylesheets

would it make a big difference as far as load time to combine the stylesheets?

18 Apr 2008, 5:40 AM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Combining Stylesheets

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.

25 Aug 2009, 3:09 PM
#9
danglez avatar

danglez

New Zenner

Join Date:
Jul 2009
Posts:
5
Plugin Contributions:
1

Re: Combining Stylesheets

What is the best way to merge stylesheets?

25 Aug 2009, 4:17 PM
#10
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Combining Stylesheets

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