Skip to content

Instantly share code, notes, and snippets.

@pjhoberman
Created January 27, 2011 22:17
Show Gist options
  • Save pjhoberman/799411 to your computer and use it in GitHub Desktop.
Save pjhoberman/799411 to your computer and use it in GitHub Desktop.
/* 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