示例#1
0
 /**
  * Entry point for the script
  *
  * @return  void
  *
  * @since   3.0
  */
 public function doExecute()
 {
     $templates = array(JPATH_ADMINISTRATOR . '/templates/isis/less/template.less' => JPATH_ADMINISTRATOR . '/templates/isis/css/template.css', JPATH_ADMINISTRATOR . '/templates/hathor/less/template.less' => JPATH_ADMINISTRATOR . '/templates/hathor/css/template.css', JPATH_ADMINISTRATOR . '/templates/hathor/less/colour_blue.less' => JPATH_ADMINISTRATOR . '/templates/hathor/css/colour_blue.css', JPATH_ADMINISTRATOR . '/templates/hathor/less/colour_brown.less' => JPATH_ADMINISTRATOR . '/templates/hathor/css/colour_brown.css', JPATH_ADMINISTRATOR . '/templates/hathor/less/colour_standard.less' => JPATH_ADMINISTRATOR . '/templates/hathor/css/colour_standard.css', JPATH_SITE . '/templates/protostar/less/template.less' => JPATH_SITE . '/templates/protostar/css/template.css', __DIR__ . '/less/bootstrap-extended.less' => JPATH_SITE . '/media/jui/css/bootstrap-extended.css', __DIR__ . '/less/bootstrap-rtl.less' => JPATH_SITE . '/media/jui/css/bootstrap-rtl.css');
     $less = new JLess();
     foreach ($templates as $source => $output) {
         try {
             $less->compileFile($source, $output);
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     }
 }
示例#2
0
 /**
  * Entry point for the script
  *
  * @return  void
  *
  * @since   3.0
  */
 public function doExecute()
 {
     $templates = array(JPATH_ADMINISTRATOR . '/templates/isis/less/template.less' => JPATH_ADMINISTRATOR . '/templates/isis/css/template.css', JPATH_ADMINISTRATOR . '/templates/isis/less/template-rtl.less' => JPATH_ADMINISTRATOR . '/templates/isis/css/template-rtl.css', JPATH_SITE . '/templates/protostar/less/template.less' => JPATH_SITE . '/templates/protostar/css/template.css', JPATH_SITE . '/templates/beez3/css/turq.less' => JPATH_SITE . '/templates/beez3/css/turq.css', __DIR__ . '/less/bootstrap-extended.less' => JPATH_SITE . '/media/jui/css/bootstrap-extended.css', __DIR__ . '/less/bootstrap-rtl.less' => JPATH_SITE . '/media/jui/css/bootstrap-rtl.css');
     $less = new JLess();
     $less->setFormatter(new JLessFormatterJoomla());
     foreach ($templates as $source => $output) {
         try {
             $less->compileFile($source, $output);
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     }
 }
示例#3
0
 /**
  * Compile less using the less compiler under /build.
  *
  * @param   string  $input  The relative location of the less file.
  *
  * @return  boolean  true if compilation is successful, false otherwise
  *
  * @since   3.2
  */
 public function compileLess($input)
 {
     if ($template = $this->getTemplate()) {
         $app = JFactory::getApplication();
         $client = JApplicationHelper::getClientInfo($template->client_id);
         $path = JPath::clean($client->path . '/templates/' . $template->element . '/');
         $inFile = urldecode(base64_decode($input));
         $explodeArray = explode('/', $inFile);
         $fileName = end($explodeArray);
         $outFile = reset(explode('.', $fileName));
         $less = new JLess();
         $less->setFormatter(new JLessFormatterJoomla());
         try {
             $less->compileFile($path . $inFile, $path . 'css/' . $outFile . '.css');
             return true;
         } catch (Exception $e) {
             $app->enqueueMessage($e->getMessage(), 'error');
         }
     }
 }