mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-13 18:15:48 +02:00
Add basic js minification (trim whitespace and remove single line comments)
This commit is contained in:
parent
9d052c8339
commit
77b5c95f75
12
Resources/PostBuild.ps1
Normal file
12
Resources/PostBuild.ps1
Normal file
@ -0,0 +1,12 @@
|
||||
Param([Parameter(Mandatory = $True, Position = 1)][string] $dir)
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Set-Location $dir
|
||||
|
||||
ForEach($file in Get-ChildItem -Include *.js, *.html -Recurse){
|
||||
$lines = Get-Content -Path $file.FullName
|
||||
$lines = ($lines | % { $_.TrimStart() }) -Replace '^(.*?)((?<=^|[;{}()] )//\s.*)?$', '$1'
|
||||
$lines | Where { $_ -ne '' } | Set-Content -Path $file.FullName
|
||||
|
||||
Write-Host "Processed" $file.FullName.Substring($dir.Length)
|
||||
}
|
@ -323,6 +323,7 @@
|
||||
<None Include="Resources\icon-small.ico" />
|
||||
<None Include="Resources\icon-tray-new.ico" />
|
||||
<None Include="Resources\icon-tray.ico" />
|
||||
<None Include="Resources\PostBuild.ps1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\Plugins\" />
|
||||
@ -382,7 +383,9 @@ if $(ConfigurationName) == Debug (
|
||||
rmdir "$(TargetDir)plugins\official\.debug" /S /Q
|
||||
mkdir "$(TargetDir)plugins\user\.debug"
|
||||
xcopy "$(ProjectDir)Resources\Plugins\.debug\*" "$(TargetDir)plugins\user\.debug\" /E /Y
|
||||
)</PostBuildEvent>
|
||||
)
|
||||
|
||||
powershell -ExecutionPolicy Unrestricted -File "$(ProjectDir)Resources\PostBuild.ps1" "$(TargetDir)\"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user