/** * Enqueue compiled wp scripts. */ public function compile_page_scripts() { if (!beans_get_component_support('wp_scripts_compiler') || !get_option('beans_compile_all_scripts', false) || _beans_is_compiler_dev_mode()) { return; } if ($scripts = $this->compile_enqueued('script')) { beans_compile_js_fragments('beans', $scripts, array('in_footer' => true, 'version' => null)); } }
/** * Formal CSS, LESS and JS content. */ public function format_content($content) { if ($this->compiler['type'] == 'style') { if ($this->compiler['format'] == 'less') { if (!class_exists('lessc')) { require_once BEANS_API_COMPONENTS_PATH . 'compiler/vendors/lessc.php'; } $less = new lessc(); $content = $less->compile($content); } if (_beans_is_compiler_dev_mode() === false) { $content = $this->strip_whitespace($content); } } if ($this->compiler['type'] == 'script' && _beans_is_compiler_dev_mode() === false && $this->compiler['minify_js']) { if (!class_exists('JSMin')) { require_once BEANS_API_COMPONENTS_PATH . 'compiler/vendors/js-minifier.php'; } $js_min = new JSMin($content); $content = $js_min->min(); } return $content; }
/** * Maybe show disabled notice. */ public function maybe_disable_scripts_notice() { if (get_option('beans_compile_all_scripts') && _beans_is_compiler_dev_mode()) { echo '<br /><span style="color: #d85030;">' . __('Scripts are not compiled in development mode.', 'tm-beans') . '</span>'; } }
/** * 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; }