Skip to content

Instantly share code, notes, and snippets.

@dbergey
Created June 16, 2010 14:55
Show Gist options
  • Save dbergey/440808 to your computer and use it in GitHub Desktop.
Save dbergey/440808 to your computer and use it in GitHub Desktop.
// Here is how to get less parsing of <style> tags for quick development
// I made this with less.js 1.0.17, not sure how far back it works
// change this to wherever your less.js is stored
<script src="http://dkb.local/js/lessjs/less.js"></script>
// then do this somewhere
<script>
var styleEls = document.getElementsByTagName('style');
for (var i in styleEls)
(new less.Parser).parse(styleEls[i].innerHTML || '', function(e, css) {
styleEls[i].innerHTML = css.toCSS();
});
</script>
@cloudhead
Copy link

Interesting idea—I think I'm going to make it built-in.

@dbergey
Copy link
Author

dbergey commented Jun 17, 2010

Excellent. :D

@dbergey
Copy link
Author

dbergey commented Jun 17, 2010

Updated to use innerHTML (so it doesn't insert
s) and a fallback string.

@dbergey
Copy link
Author

dbergey commented Jul 1, 2010

This is unneeded from 1.0.30 and forward, just use < style type="text/less" >< /style >.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment