Projekt

Allgemein

Profil

JProofLess fast Usage

Installation

  • Got to Joomla Backend
  • -> Extensions
  • -> Installation
  • -> install from Url
    • http://public.jproof.de/jproofless/stable/latest.tar.gz
  • ->install!
  • Ready to Rumble

Usage

In Your Template before the Html starts

Simple way

if (JLoader::import('jproofless.jproofless'))
{
    $joomlaLess = JProofLess::getInstance();
    $joomlaLess->setLessFile(JPATH_THEMES . '/' . $this->template . '/less/template.less');
    $joomlaLess->setCssFile(JPATH_THEMES . '/' . $this->template . '/css/template.css');
    $joomlaLess->autoCompile();
}

Or more safer (if the Joomla Installation is not under your control )

if (JLoader::import('jproofless.jproofless'))
{
    $joomlaLess = JProofLess::getInstance();
    $joomlaLess->setLessFile(JPATH_THEMES . '/' . $this->template . '/less/template.less');
    $joomlaLess->setCssFile(JPATH_THEMES . '/' . $this->template . '/css/template.css');
    $joomlaLess->autoCompile();
}else{
    // adding an Log message if it is an good choice to install the JProofLess
    JLog::add('JProofLess is missing: ' . __FILE__ . ' @see <a target="_blank" href="http://wiki.jproof.de/projects/joomla-library-jproof-less/wiki"><b>Wiki</b></a>',
          JLog::NOTICE);

    // Adding each time the regular already rendered css into the template if the LessCompiler not found
    JFactory::getDocument()->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css');
}