compile() public method

public compile ( $string, $name = null )
Exemplo n.º 1
0
 /**
  * Formal CSS, LESS and JS content.
  */
 public function format_content($content)
 {
     if ('style' == $this->compiler['type']) {
         if ('less' == $this->compiler['format']) {
             if (!class_exists('Beans_Lessc')) {
                 require_once BEANS_API_PATH . 'compiler/vendors/lessc.php';
             }
             $less = new Beans_Lessc();
             $content = $less->compile($content);
         }
         if (!_beans_is_compiler_dev_mode()) {
             $content = $this->strip_whitespace($content);
         }
     }
     if ('script' == $this->compiler['type'] && !_beans_is_compiler_dev_mode() && $this->compiler['minify_js']) {
         if (!class_exists('JSMin')) {
             require_once BEANS_API_PATH . 'compiler/vendors/js-minifier.php';
         }
         $js_min = new JSMin($content);
         $content = $js_min->min();
     }
     return $content;
 }