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.

Was it helpful?

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top