An htmlresponse plugin for Jelix 1.3 to be able to use lessphp easily
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lessphp
.gitmodules
README.md

README.md

What is jelix-lessphp-plugin ?

This project is a plugin for Jelix PHP framework. It allows you to use easily less dynamic stylesheet language in Jelix (using lessphp compiler).

This is an htmlresponse plugin.

Installation

Under Jelix default configuration, create an "htmlresponse" directory in your project's "plugins" directory. Clone this repository in that directory.

Note that you should have your app plugin directory in your modulesPath (defaultconfig.ini.php or entry point's config.ini.php) to get it working. The value should be at least :

modulesPath="app:modules/"

Usage

When including a CSS file (e.g. with addCSSLink()) you should set "stylesheet/less" for the "rel" param.

E.g. in your response :

$this->addCSSLink($gJConfig->urlengine['basePath'].'themes/'.$gJConfig->theme.'/Css/style.css', array( 'rel' => 'stylesheet/less' ));

Your config file must activate lessphp plugin :

[jResponseHtml]
plugins=lessphp

N.B. : the directories containing less files should be writable by your web server ! Indeed, compiled files will be written in that very same directory so that relative urls go on working ...

If you which to switch between lessphp and client-side less, you should just have to remove "lessphp" from your jResponseHtml's plugins and include less.js.

Config

You can configure lessphp's behviour regarding compilation:

[jResponseHtml]
;...
; always|onchange|once
lessphp_compile=always

If lessphp_compile's value is not valid or empty, its default value is onchange.

  • always : compile less file on all requests
  • onchange : compile less file only if it has changed
  • once : compile less file once and never compile it again (until compiled file is removed)