Question

I recently downloaded a css file and I accidentally formatted it to this:

.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:"";line-

height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-

shadow:none;background-color:transparent;border:0}

for about 10,000 lines.

How can I remove all the spaces so it looks like:

.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}

for example.

Était-ce utile?

La solution 2

If you use a text editor like Sublime text, you could use regex to get every space and then delete it.

Regex:

\s

If not, you can use simple website tools like:

CSS Minifier

Online YUI Compressor

CSS Compressor

Autres conseils

You can try online CSS minifiers. Here is list for beginning:

Hopefully you will find useful for time being, and for future I'm recommending to start using CSS libraries such as LESS or SASS, which you can easily compress later on.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top