Created
October 24, 2011 18:45
-
-
Save cbilson/1309783 to your computer and use it in GitHub Desktop.
Was going to do this to recompile all our coffee scripts when they change, but found a better way
This file contains hidden or 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
task Start-Coffee-Watcher -Description "when a coffee file changes recompile - for testing" { | |
Start-Job -Name "CoffeeWatcher" -ArgumentList "$srcDir\WebRole\scripts" -ScriptBlock { | |
param($scriptsFolder) | |
Write-Host "Watching $scriptsFolder" | |
$recompile = { | |
# TODO: Figure out how to recompile coffee scripts from command line with SassAndCoffee | |
} | |
$scriptsFileSystemWatcher = New-Object io.FileSystemWatcher -Property @{ | |
Path = $scriptsFolder | |
Filter = '*.coffee' | |
IncludeSubdirectories = $true | |
NotifyFilter = [io.NotifyFilters]'FileName, LastWrite' | |
EnableRaisingEvents = $true | |
} | |
$onCreate = Register-ObjectEvent $scriptsFileSystemWatcher Created -SourceIdentifier FileCreated -Action { | |
& $recompile | |
} | |
$onChange = Register-ObjectEvent $scriptsFileSystemWatcher Changed -SourceIdentifier FileChanged -Action { | |
& $recompile | |
} | |
while ($true) { Sleep 100; Get-Event } | |
} | |
} | |
task Stop-Coffee-Watcher { | |
Stop-Job -Name "CoffeeWatcher" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment