Zeromax / contao-sb-admin

Contao CMS Backend Theme
GNU Lesser General Public License v3.0
7 stars 0 forks source link

Adding your own custom css to the theme #42

Closed renaudkaczmarek closed 8 years ago

renaudkaczmarek commented 8 years ago

Hello !

is there a way for you to add the possibility for your users to add custom CSS to correct some issues relative to some extensions ?

In other words, I want to customize the sb-theme without risking to reset the code I have injected in \system\themes\sb-admin\css\style.css when I update it.

I hope you will understand.

Thank you for your time ;)

renaudkaczmarek commented 8 years ago

Here is an example. I use Rocksolid Custom Elements and Rocksolid Icons. So here is the issue I want to correct by myself without disturbing you for every specific extensions I used on Contao :

articles test editer l element de contenu id 1506 contao open source cms 3 5

AFTER CORRECTION

.rip_icons > a{ font-size: 22px; }
.rip_selected_icon {    font-size: 18px; }

articles test editer l element de contenu id 1506 contao open source cms 3 5s

Zeromax commented 8 years ago

You are already able to do it:

if (TL_MODE == 'BE')
{
    $GLOBALS['TL_CSS']['your_custom_key'] = $GLOBALS['TL_CONFIG']['debugMode'] ? 
    'path/to/style_src.css'  :  'path/to/style_min.css';
}

It's a Contao feature.

renaudkaczmarek commented 8 years ago

Thank you so much for your answer, I tried and of course it works. But if I want to only override the sb-admin theme ? Unfortunatly, there is no class on the for the sb-admin theme.

Do you understand ?

Zeromax commented 8 years ago

Ah yes I understand. I think I can add a CSS class in the be_main.html5 like sb-admin-theme.

Also you may use:

if ( TL_MODE == 'BE' && \Config::get('backendTheme') == 'sb-admin' )
{
    $GLOBALS['TL_CSS']['your_custom_key'] = $GLOBALS['TL_CONFIG']['debugMode'] ? 
    'path/to/style_src.css'  :  'path/to/style_min.css';
}
renaudkaczmarek commented 8 years ago

Ho that sounds great !

I tried the "Also you may use" but it doesn't seems to work :p are sure about "&& \Config::get('backendTheme') == 'sb-admin'" ? It works without it.

Zeromax commented 8 years ago

Just use the dev edition CSS class sb-admin-theme or try: $GLOBALS['TL_CONFIG']['backendTheme'] == 'sb-admin'

renaudkaczmarek commented 8 years ago

Thank you so much for your time ;)