This question is not so specific, but I will ask it anyway.

Is it possible (better possible and easy) to use less compiler when saving options for a component or plugin?

What I want - many content plugins offer user input css, which they inject directly into html code as inline style. My idea is to modify and compile css file when pressing 'Save' button in the backend. This will eliminate use of inline css-es, but will preserve option for user modifications there. I've read about firing less compiler at page load, but I think this should be avoided too.

What is your opinion? And to be more specific - what kind of code I need and where to locate Save action?


2 Answers 2


If you're referring to when any component, plugin or module is saved, then this I do not believe is possible. If I'm not mistaken, you can only manipulate the save function for each individual component.

What I would recommend doing is creating a plugin and compile the LESS using the onBeforeCompileHead event. You're going to have to copy the compileLess function and make some changes to it as it. For this, check line 742 of the following file:


You plugin could look a little like this:

class plgSystemCompileLess extends JPlugin

    public function onBeforeCompileHead()
        $app = JFactory::getApplication();

        // Only compile this for the frontend
        if ($app->isSite()) 
            // Call your compileLess function here

  • I want to modify one plugin. There is a lot of user css inputs, and all that is going inline. I will try your approach.
    – Plamen
    Apr 23, 2015 at 19:08

For automatic and controlled rendering of less in joomla try out the jprooless library if you are an developer/template-designer. You can configure it, also you are able to force the rendering on each page-load(for development/testing is usfull).

Template Administrators with lesser knowledge about php coding and joomla internals use the pkg_jproofless*. is written in top of the library


hope that helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.