e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
322 stars 214 forks source link

I/Q: Theme and CSS Override #3054

Closed LaocheXe closed 4 years ago

LaocheXe commented 6 years ago

Using Bootstrap 3, I know if I want to override the code for whatever I want, I need to change the style.css - however, in theme manager I can select what css I want to use, by default it's the normal style.css.

So If I created a Laochexe.css, I can select it, however, it cannot override the default bootstrap.css - can this be changed to allow any css in the theme manager that is in the theme css folder to override the others when selected?

Example: capture

I wanted to change the btn-primary to another color - code I put into laochexe.css is btn-primary { color: #fff; background-color: #110c5e; border-color: #fff; }

save, upload the new css, go into admin area, theme manager, select the new css, changes should apply, however they don't - now I can go into style.css to make the change happen, but if I'm creating a theme (the bootstrap 3 I'm working on has been modified) I would like to provide different looks via css, and allow the end user to either select one, or even select one and modify it to their liking.

Jimmi08 commented 4 years ago

@Moc this should be closed. I am sure that there are no problems. It just to be done the correct way.

using just btn-primary is not enough. This is related to css and overriding css rules (cascading) and not e107 itself.

Moc commented 4 years ago

@Jimmi08 Ok, I'll close this issue. Maybe you can post a short example here? Then I will add it to the documentation in the future.

Jimmi08 commented 4 years ago

CSS PART Some way:

E107 PART

It depends if you want css switcher or you will use preference for this

With css switcher, you should be sure that your code from style.css is loaded in all css files.

The way I am using now:

    <stylesheets>
        <css file="style_default.css" name="Default Dark Version"  />
        <css file="style_orange.css" name="Orange Dark Version" />
        <css file="style_green.css" name="Nightvision Dark Version" />
        <css file="style_light_default.css" name="Default Light Version" />
    </stylesheets>  

and then e107::css('theme', 'style.css'); //if it is not used in theme.xml

this way files are loaded in order:

image

I run on this issue because I was searching the answer on my question if it is standard that with style variations (more than one css in theme.xml) style.css is not loaded at all (it breaks the rule that style.css is always loaded as last one css file).

Let me know if you need to add something. I just work with it so I had time...

Of course, I didn't mention the sass option, but from the question's type, I don't think this is needed.