Created
June 21, 2010 01:03
-
-
Save tathamoddie/446266 to your computer and use it in GitHub Desktop.
Web asset merging with PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
set tempscript=%temp%\%~n0.%random%.ps1 | |
echo $ErrorActionPreference="Stop" >"%tempscript%" | |
echo ^& "%~dpn0.ps1" %* >>"%tempscript%" | |
powershell.exe -command "& \"%tempscript%\"" | |
set errlvl=%ERRORLEVEL% | |
del "%tempscript%" | |
exit /b %errlvl% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Version 2 | |
param ( | |
[switch]$Verbose = $false | |
) | |
$ErrorActionPreference = "Stop" | |
if ($Verbose) { $VerbosePreference = "Continue" } | |
$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName | |
$PSScriptRoot = Split-Path -Path $PSScriptFilePath -Parent | |
$SearchPath = $PSScriptRoot | |
Write-Verbose "Searching recursively for *.set in $SearchPath" | |
$SetDefinitions = Get-ChildItem -Path $SearchPath -Include "*.set" -Recurse | |
ForEach($SetDefinition in $SetDefinitions) | |
{ | |
$SetOutput = Join-Path $SetDefinition.DirectoryName -ChildPath $SetDefinition.BaseName | |
$SetRoot = Split-Path $SetDefinition -Parent | |
Get-Content $SetDefinition | | |
%{ Get-Content -Path (Join-Path $SetRoot -ChildPath $_) } | | |
Set-Content -Path $SetOutput | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yui/core-library.js | |
some-dependency.js | |
some-other-dependency.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment