Created
July 8, 2010 19:07
-
-
Save andyfowler/468446 to your computer and use it in GitHub Desktop.
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
# ideal for textmate bundle, reloads the current tab's CSS | |
# JS via http://david.dojotoolkit.org/recss.html | |
refreshScript=`cat <<'JAVASCRIPT' | |
void(function(){var i,a,s;a=document.getElementsByTagName('link');for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {var h=s.href.replace(/(&|\\\?)forceReload=\\\d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf())}}})(); | |
JAVASCRIPT | |
` | |
# Check if Safari is running, if so refresh CSS | |
ps -xc|grep -sq Safari && osascript <<APPLESCRIPT | |
tell app "Safari" | |
activate | |
do JavaScript "$refreshScript" in document 1 | |
end tell | |
APPLESCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment