Reduce loading time with a compressed library environment
Posted: Fri Dec 25, 2015 6:01 am
Hello community,
the javascript directory of SpiderBasic contains a lot of JS- and CSS-files. I checked the loading time of the 2ddrawing-example via GTmetrix (http://gtmetrix.com) and in the result table are the suggestion to compress the JS- and CSS-files to reduce the loading time. I look for a JS/CSS-compressor for the Windows environment and I found Microsofts Ajax Minifier (http://ajaxmin.codeplex.com). AjaxMin is a command line tool. To feed AjaxMin I code a PowerShell script and this creates a batch file.
Copy this script in a copy of the javascript directory and run it. Move the Min-batch file to AjaxMin program and run it. After that the size of the directory is reduced by 48,5%. I copy this javascript directory in my production environment and the loading time is speed up by 10%.
Enjoy it.
Cheers
Stefan
the javascript directory of SpiderBasic contains a lot of JS- and CSS-files. I checked the loading time of the 2ddrawing-example via GTmetrix (http://gtmetrix.com) and in the result table are the suggestion to compress the JS- and CSS-files to reduce the loading time. I look for a JS/CSS-compressor for the Windows environment and I found Microsofts Ajax Minifier (http://ajaxmin.codeplex.com). AjaxMin is a command line tool. To feed AjaxMin I code a PowerShell script and this creates a batch file.
Code: Select all
#-Begin-----------------------------------------------------------------
$Content = ""
#-Get all JavaScript files--------------------------------------------
$Files = Get-ChildItem . -Filter "*.js" -Recurse
$Files | ForEach-Object {
$Line = "AjaxMinifier.exe -JS """ + $_.FullName + """ -out """ +
$_.FullName + """"
$Content += $Line + "`r`n"
}
#-Get all Cascading Style Sheet files---------------------------------
$Files = Get-ChildItem . -Filter "*.css" -Recurse
$Files | ForEach-Object {
$Line = "AjaxMinifier.exe -CSS """ + $_.FullName + """ -out """ +
$_.FullName + """"
$Content += $Line + "`r`n"
}
#-Write the batch file------------------------------------------------
New-Item . -Name Min.bat -Type "File" -Value $Content -Force
#-Delete all LICENSE and README.md files------------------------------
$Files = Get-ChildItem . -Include "LICENSE", "README.md" -Recurse
$Files | ForEach-Object {
Remove-Item $_.FullName
}
#-End-------------------------------------------------------------------

Enjoy it.
Cheers
Stefan