Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any tools for merging CSS? [closed]

Tags:

css

I have a couple CSS files with overlapping CSS selectors that I'd like to programmatically merge (as in not just appending one file to the end of the other). Is there any tool to do this online? or a Firefox extension perhaps?

like image 532
M. Dave Auayan Avatar asked Aug 19 '08 19:08

M. Dave Auayan


People also ask

How do I combine multiple CSS files into one?

To combine external CSS files, you can simply copy / paste all of your CSS code into one main file. Therefore all of the content from within the other CSS files will now reside within the main file allowing the browser to only make one request for a CSS file instead of multiple.

How do I combine both HTML and CSS?

Use <style type="text/css"></style> in your header tag to merge the css and html into one file. Then paste your css in between the style tags.

How do I combine CSS files in WordPress?

You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. Once installed you will want to go into the settings and enable the “Optimize CSS Code” option. This will concatenate (combine) your CSS files.


2 Answers

I found Factor CSS - complete with source code, but I think it does way more than I'd need. I really just want to combine CSS blocks that have the same selectors. I'll check out the source code and see if it can be converted to something usable as a TextMate bundle. That is, unless someone else manages to get to it before me.

EDIT: Even better - here's a list of web-based tools for checking/formatting/optimizing css.

like image 104
M. Dave Auayan Avatar answered Oct 05 '22 00:10

M. Dave Auayan


No I wish there was but the programming effort seems too much since there are multiple ways to reference a single element. The best that you can do is use a runtime like FireBug to find duplicates.

like image 22
Nick Berardi Avatar answered Oct 05 '22 00:10

Nick Berardi