Created
January 27, 2011 22:17
-
-
Save pjhoberman/799411 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
/* include this file with livecss.js | |
* add a querystring param livecss, set to true | |
* example: http://yourawesomesite.com/somefile.html?livecss=true | |
* live css will watch on every reload as long as the querystring is there and true | |
*/ | |
function getParameterByName( name ) | |
{ | |
// copied from http://stackoverflow.com/questions/901115/get-querystring-values-with-jquery | |
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); | |
var regexS = "[\\?&]"+name+"=([^&#]*)"; | |
var regex = new RegExp( regexS ); | |
var results = regex.exec( window.location.href ); | |
if( results == null ) | |
return ""; | |
else | |
return decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
$(document).ready(function(){ | |
if( getParameterByName( 'livecss' ) === "true" ) | |
livecss.watchAll(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment