문제

I wonder are there any Grunt tasks which uglify CSS? Like in GMail code — all class names are random 2-3 letters.

I'm using AngularJS and grunt-angular-templates Grunt task to concatenate all templates in views/ folder to a single templates.js $templateCache file and I want to make this file as small as possible.

I have index.html, main.css and views/ folder with bunch of HTML files — I want to uglify all CSS class names in all these files, 'cos I'm using BEM class name notation, so my CSS class names are rather long.

도움이 되었습니까?

해결책

if the only reason to uglify is the length of classnames — just don't. gzip (use zopfli for the best result) makes all that long BEMish classes just same 2-3 letters long but on server level.

다른 팁

Here's a library to uglify css. If you want to use it in grunt then wrap it in a custom grunt task.

https://github.com/fmarcia/UglifyCSS

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top