Editing less and css files

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
dcnola
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jan 26, 2015 7:12 pm

Editing less and css files

Post by dcnola » Thu Feb 12, 2015 10:51 pm

I'm new to Joomla and less files, although I'm very familiar with html and css. I've got a template on my site from template monster and I'm trying to edit some of the colors. In the theme's css folder template.css is a 10k or so line css file where I can find the various variables I'm looking for and edit. This does work, but from what I've read it seems I would be better doing this by editing the less files.

I looked through these files and the template.less file is just using variables from the variables.less file. For example @grayDark: #333333;. I've tried to edit the values in this variables.less file, then save it, hit the compile less button (I'm doing this all from within the template manager page on the back end), and then clear the cache. When I go reload the front end pages nothing has changed.

I assumed this would change any place using the @grayDark variable, to the blue I changed it to, but nothing. I tried to change another couple of the colors, compiled the file again, and then even compiled the template.less file since I figured maybe this is generating the template.css file. This didn't do anything either. What am I doing wrong?

When I changed the template.css file it did show my changes, but I thought on compile of the .less files it would just overwrite this .css file. I tried it, and my changes to the .css file stayed. Maybe I'm just not getting how this is supposed to work?

User avatar
guywalder
Joomla! Explorer
Joomla! Explorer
Posts: 301
Joined: Mon Mar 04, 2013 9:55 am
Contact:

Re: Editing less and css files

Post by guywalder » Fri Feb 13, 2015 6:23 pm

Hi,

First I would suggest you contact Template Monster regarding this. Second, do you know what framework is your template based upon?

When LESS is used the CSS files are created on the fly from several less files compiled together. So, in many cases, a line you've changed in the CSS can be overwritten by the LESS line. If your styling was not overwritten then you've got lucky and this line did not have any LESS line overwriting it. Hence, when LESS is in use it is bad practice to edit CSS files.

You'll need to make the changes to the LESS files. Unfortunately, in many cases it's tricky to locate all the LESS files one CSS file is comprised off so I wouldn't try going that way. Having said that, you can create a custom.less file and add it to the master.less file so it will be compiled with all the rest LESS files. In this file, you can make all the changes you'll like and overwrite other LESS styling.

Before you make any step, find out what framework is used in your template and Google your options.

Good luck and remember, Joomla has the best community :)

dcnola
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jan 26, 2015 7:12 pm

Re: Editing less and css files

Post by dcnola » Fri Feb 13, 2015 7:29 pm

Hi,
You are pretty much saying what everything I've read has said. Editing the variables.less file should change things, because all the other .less files just import this file and use the variables. After changing a variable and compiling the less file and then compiling the main template.less file as well nothing changes on the site when I reload it. I'll try to contact template monster and see if they know why. I believe this template is just using the bootstrap framework.

User avatar
JohnKeays
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Jan 16, 2014 1:24 pm
Location: brisbane
Contact:

Re: Editing less and css files

Post by JohnKeays » Tue Mar 20, 2018 2:23 pm

I am having the same trouble with the less compiler. I have updated template.less with an background-image: and the code does not appear in template.css after the compilation. If the compilation fails then nothing changes. That's okay. But if it compiles and leaves out code in template.css then Iam having the same trouble as others have reported. Is it just flakey code in the compiler. How do I debug this Help...
John Keays

Code: Select all

from Keays Software

gws
Joomla! Champion
Joomla! Champion
Posts: 5921
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Editing less and css files

Post by gws » Tue Mar 20, 2018 2:32 pm

It is better not to necropost and open your own new issue.


Locked

Return to “Templates for Joomla! 3.x”