开发者

LESS CSS - Extract the CSS generated

I am trying to use LESS CSS to write my CSS. I have imported the style.less and less.js file in that order.

Now i wanna extract the CSS that LESS generates.. is there any way i can do that ? i dont want to use the script to generate it dynamically i开发者_JAVA百科n production. just for development.


You can extract the CSS using the Firebug extension in Firefox. The compiled CSS appears under the menu choice "inline" in the CSS tab.


http://incident57.com/less/ if you're fortunate enough to use OS X, and there's a ruby gem too http://rubygems.org/gems/less although this has been superseded by the node.js implementation installed through npm. Check http://lesscss.org/ for more information.

There's also http://www.dotlesscss.org/ for windows, but not sure how useful it is.


And in 2013 we have:

http://less2css.org/

Seems to work just fine for me. Just copy/paste.

Chances are you'll want to minify your CSS after this, so:

http://cssminifier.com/


For others who'd stumble here, in modern browser you can see it in the LocalStorage. I use Chrome and it's in the dev toolbar under Resources. In my case we also want to save the css file automatically (we have a tool that generates a template), we can do it easily with javascript.

This returns the generated CSS, just replace it with the right path, as you see it under the Resources tab: localStorage.getItem('http://domain.com/css/main.less');

Then we send that through Ajax to save it in a css file. When switching to production we remove the less and replace it by the generated css file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜