diff options
Diffstat (limited to 'lib/private/minimizer/js.php')
-rw-r--r-- | lib/private/minimizer/js.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/minimizer/js.php b/lib/private/minimizer/js.php new file mode 100644 index 00000000000..bd2d836deb0 --- /dev/null +++ b/lib/private/minimizer/js.php @@ -0,0 +1,21 @@ +<?php + +require_once 'mediawiki/JavaScriptMinifier.php'; + +class OC_Minimizer_JS extends OC_Minimizer +{ + protected $contentType = 'application/javascript'; + + public function minimizeFiles($files) { + $js_out = ''; + foreach($files as $file_info) { + $file = $file_info[0] . '/' . $file_info[2]; + $js_out .= '/* ' . $file . ' */' . "\n"; + $js_out .= file_get_contents($file); + } + if (!defined('DEBUG') || !DEBUG) { + $js_out = JavaScriptMinifier::minify($js_out); + } + return $js_out; + } +} |