Enabled JS file reduction

This commit is contained in:
Pierre 2018-04-29 21:25:00 +02:00
parent 7887080073
commit f6297b39fb
2 changed files with 14 additions and 6 deletions

12
build
View File

@ -145,8 +145,9 @@ files_to_file($thirdPartyDebugFiles, $targetThirdPartyCSS);
//3rd party JS //3rd party JS
notice("Third Party JS"); notice("Third Party JS");
$thirdPartyDebugFiles = array_put_begining($path_debug_assets, $debug::THIRD_PARTY_JS); $thirdPartyDebugFiles = array_put_begining($path_debug_assets, $debug::THIRD_PARTY_JS);
$targetThirdPartyUnminifiedJS = $path_release_assets.$release::THIRD_PARTY_UNMINIFIED_JS;
$targetThirdPartyJS = $path_release_assets.$release::THIRD_PARTY_JS; $targetThirdPartyJS = $path_release_assets.$release::THIRD_PARTY_JS;
files_to_file($thirdPartyDebugFiles, $targetThirdPartyJS); files_to_file($thirdPartyDebugFiles, $targetThirdPartyUnminifiedJS);
//App CSS //App CSS
notice("App CSS"); notice("App CSS");
@ -157,8 +158,9 @@ files_to_file($appDebugFiles, $targetAppCSS);
//App JS //App JS
notice("App JS"); notice("App JS");
$appDebugFiles = array_put_begining($path_debug_assets, $debug::APP_JS); $appDebugFiles = array_put_begining($path_debug_assets, $debug::APP_JS);
$targetAppUnminifiedJS = $path_release_assets.$release::APP_UNMINIFIED_JS;
$targetAppJS = $path_release_assets.$release::APP_JS; $targetAppJS = $path_release_assets.$release::APP_JS;
files_to_file($appDebugFiles, $targetAppJS); files_to_file($appDebugFiles, $targetAppUnminifiedJS);
//Make some adpations on third party files //Make some adpations on third party files
@ -166,12 +168,18 @@ $source = file_get_contents($targetThirdPartyCSS);
$source = str_replace("../fonts/fontawesome", "fontawesome_fonts/fontawesome", $source); $source = str_replace("../fonts/fontawesome", "fontawesome_fonts/fontawesome", $source);
file_put_contents($targetThirdPartyCSS, $source); file_put_contents($targetThirdPartyCSS, $source);
//Minify Javascript files
exec("/usr/bin/uglifyjs '".$targetThirdPartyUnminifiedJS."' -c -o '".$targetThirdPartyJS."'");
exec("/usr/bin/uglifyjs '".$targetAppUnminifiedJS."' -c -o '".$targetAppJS."'");
//Copy font awesome files and twemojies files + Google Fonts //Copy font awesome files and twemojies files + Google Fonts
rcopy($path_debug_assets."3rdparty/adminLTE/plugins/font-awesome/fonts", $path_release_assets."fontawesome_fonts"); rcopy($path_debug_assets."3rdparty/adminLTE/plugins/font-awesome/fonts", $path_release_assets."fontawesome_fonts");
rcopy($path_debug_assets."3rdparty/twemoji/2/72x72/", $path_release_assets."3rdparty/twemoji/2/72x72/"); rcopy($path_debug_assets."3rdparty/twemoji/2/72x72/", $path_release_assets."3rdparty/twemoji/2/72x72/");
rcopy($path_debug_assets."3rdparty/adminLTE/plugins/googleFonts/googleFonts/", $path_release_assets."googleFonts/"); rcopy($path_debug_assets."3rdparty/adminLTE/plugins/googleFonts/googleFonts/", $path_release_assets."googleFonts/");
rcopy($path_debug_assets."3rdparty/wdt-emoji/sheets/", $path_release_assets."3rdparty/wdt-emoji/sheets/"); rcopy($path_debug_assets."3rdparty/wdt-emoji/sheets/", $path_release_assets."3rdparty/wdt-emoji/sheets/");
//Copy images and templates //Copy images and templates
rcopy($path_debug_assets."img/", $path_release_assets."img/"); rcopy($path_debug_assets."img/", $path_release_assets."img/");
rcopy($path_debug_assets."templates/", $path_release_assets."templates/"); rcopy($path_debug_assets."templates/", $path_release_assets."templates/");

View File

@ -45,9 +45,9 @@ class Offline {
const THIRD_PARTY_JS = "third_party.js"; const THIRD_PARTY_JS = "third_party.js";
/** /**
* Third party Javascript files (bundle) * Third party Javascript files (unminified)
*/ */
const THIRD_PARTY_BUNDLE_JS = "third_party.bundle.js"; const THIRD_PARTY_UNMINIFIED_JS = "third_party.unminified.js";
/** /**
* Application CSS files * Application CSS files
@ -60,9 +60,9 @@ class Offline {
const APP_JS = "app.js"; const APP_JS = "app.js";
/** /**
* Application JS files (bundles) * Application JS files (unminifieds)
*/ */
const APP_BUNDLE_JS = "app.bundle.js"; const APP_UNMINIFIED_JS = "app.unminified.js";
/** /**
* Language settings * Language settings