Minify the passed in JS

@param string $jsText

@return string
499165
public function jsMin($jsText = "")
    {
        if ($this->shouldMinify) {
            $jsText = \JSMin\JSMin::minify($jsText);
        }

        return $jsText;
    }
1024422
protected function jsMatcher($matches)
    {
        $chr = $matches[0];
        if (strlen($chr) == 1) {
            return sprintf('\\x%02X', ord($chr));
        }
        $chr = $this->convertEncoding($chr, 'UTF-16BE', 'UTF-8');
        return sprintf('\\u%04s', strtoupper(bin2hex($chr)));
    }
762820
public static function compress($css)
    {
        $css = (string) $css;
        try {
            $css_minifier = new static($css);
            $minified_css = $css_minifier->min();
            return $minified_css;
        } catch (\Exception $exception) {
            return $css;
        }
    }
1327890
public static function minifyFiles(array $absoluteSystemPathToFiles) : string
    {
        $str = "";

        foreach ($absoluteSystemPathToFiles as $file) {
            if (file_exists($file) === true) {
                $str .= self::minifyFile($file) . "\n";
            }
        }

        return trim($str);
    }
663158
protected function jsPipeline()
	{
		// If a custom minifier has been set use it, otherwise fallback to default
		$minifier = (isset($this->js_minifier)) ? $this->js_minifier : function ($buffer) {
			return \JSMin::minify($buffer);
		};

		return $this->pipeline($this->js, '.js', $this->js_dir, $minifier);
	}
246555
public static function minify($source, array $filters = null, array $plugins = null)
		{
		self::$errors = array();
		$minifier = new CssMinifier($source, $filters, $plugins);
		return $minifier->getMinified();
		}
169502
public function process(MinifyContext $context)
    {
        $contents = preg_replace_callback(
            '/'.
                Constants::$htmlEventNamePrefix.Constants::ATTRIBUTE_NAME_REGEX.'   # Match an on{attribute}
                \s*=\s*             # Match equals sign with optional whitespaces around it
                ["\']?              # Match an optional quote
                \s*javascript:      # Match the text "javascript:" which should be removed
            /xis',
            function ($match) {
                return str_replace('javascript:', '', $match[0]);
            }, $context->getContents());

        return $context->setContents($contents);
    }
606169
public function escapeJs($js)
    {
        $js = $this->toUtf8($js);
        
        if ($js === '' || ctype_digit($js)) {
            return $js;
        }

        $result = preg_replace_callback('/[^a-z0-9,\._]/iSu', $this->jsMatcher, $js);
        
        return $this->fromUtf8($result);
    }
1321743
public function minify($path = null)
    {
        $content = $this->execute($path);

        // save to path
        if ($path !== null) {
            $this->save($content, $path);
        }

        return $content;
    }
783822
public static function convertToInlineCss($strText, $strCssText = null)
    {
        // apply the css inliner
        $objCssInliner = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles();

        return $objCssInliner->convert($strText, $strCssText);
    }
522087
protected function minifyJs()
    {
        $minifier = new Minify\JS();

        // Components
        $this->addJsToMinifier($minifier, 'dropdowns', 'dropdown');

        // Components w/ JavaScript
        $this->addJsToMinifier($minifier, 'modals', 'modal');
        $this->addJsToMinifier($minifier, 'tooltip');
        $this->addJsToMinifier($minifier, 'popovers', 'popover');
        $this->addJsToMinifier($minifier, 'carousel');

        // Pure JavaScript components
        $this->addJsToMinifier($minifier, 'affix');
        $this->addJsToMinifier($minifier, 'alert');
        $this->addJsToMinifier($minifier, 'button');
        $this->addJsToMinifier($minifier, 'collapse');
        $this->addJsToMinifier($minifier, 'scrollspy');
        $this->addJsToMinifier($minifier, 'tab');
        $this->addJsToMinifier($minifier, 'transition');

        return $minifier->minify();
    }
596250
protected function setJavascriptFileCDN($jsFileName)
    {
        $onlyFileName = pathinfo($jsFileName)['basename'];
        $patternFound = null;
        if (in_array($onlyFileName, ['jquery.placeholder.min.js', 'jquery.easing.1.3.min.js'])) {
            $patternFound = $this->setJavascriptFileCDNjQueryLibs($jsFileName);
        } elseif (strpos($onlyFileName, '-') !== false) {
            $patternFound = $this->setJavascriptFileCDNbyPattern($jsFileName);
        }
        if (is_null($patternFound)) {
            $patternFound = [false, $this->sanitizeString($jsFileName), ''];
        }
        return $patternFound;
    }
844619
public function minify($src)
	{
		$options = ($this->options) ? ' ' . $this->options : '';

		// Add our custom externs if default externs are disabled
		if ($this->excludeDefaultExterns && $this->compilationLevel === 'ADVANCED_OPTIMIZATIONS')
		{
			$options .= ' --externs ' . __DIR__ . '/../externs.application.js --env=CUSTOM';
		}

		$crc     = crc32($src);
		$inFile  = sys_get_temp_dir() . '/' . $crc . '.js';
		$outFile = sys_get_temp_dir() . '/' . $crc . '.min.js';
		file_put_contents($inFile, $src);

		$cmd = $this->command
		     . ' --compilation_level ' . escapeshellarg($this->compilationLevel)
		     . $options
		     . ' --js ' . escapeshellarg($inFile)
		     . ' --js_output_file ' . escapeshellarg($outFile);

		exec($cmd . ' 2>&1', $output, $return);
		unlink($inFile);

		if (file_exists($outFile))
		{
			$src = trim(file_get_contents($outFile));
			unlink($outFile);
		}

		if (!empty($return))
		{
			throw new RuntimeException('An error occured during minification: ' . implode("\n", $output));
		}

		return $src;
	}
791016
public function get_less($path=''){
    if ( $r = $this->get_view($path, 'css', false) ){
      return \CssMin::minify($r);
    }
  }
466696
protected function minifyAttribute($match)
    {
        if (Str::contains($match[2], $this->prohibitedChars)) {
            return $match[0];
        } elseif (preg_match('/'.Constants::PLACEHOLDER_PATTERN.'/is', $match[2])) {
            return $match[0];
        }

        return '='.$match[2];
    }
256944
public static function minifyFile(string $absoluteSystemPathToFile) : string
    {
        $cssCode = file_get_contents($absoluteSystemPathToFile);
        return self::minifyCode($cssCode);
    }
205310
public function process(MinifyContext $context)
    {
        return $context->setContents(preg_replace_callback(
            '/
                (\s*'.Constants::ATTRIBUTE_NAME_REGEX.'\s*)     # Match the attribute name
                =\s*                                            # Match the equal sign with optional whitespaces
                (["\'])                                         # Match quotes and capture for backreferencing
                \s*                                             # Strange but possible to have a whitespace in an attribute
                \2                                              # Backreference to the matched quote
                \s*
            /x',
            function ($match) {
                if ($this->isBooleanAttribute($match[1])) {
                    return Html::isLastAttribute($match[0]) ? $match[1] : $match[1].' ';
                }

                return Html::hasSurroundingAttributes($match[0]) ? ' ' : '';
            }, $context->getContents()));
    }