Settings

Theme

Show HN: Easily migrate inlined CSS to a separate CSS file (8 hour project)

cascader.co

3 points by sinaiman 15 years ago · 2 comments

Reader

sinaimanOP 15 years ago

It's mostly explained in the "about", but I have a habit of making most of my CSS changes inline in my HTML, so I use a lot of style attributes. This is usually "bad form", and I always tell myself I'll just move it all over to an external document later, but it's really annoying to do that manually.

So I made this tool last night that takes an HTML document and extracts all the inlined CSS style attributes and puts them into their own classes and then removes the style attributes from the HTML and replaces them with neat little classes.

Definitely a ton more this tool could do to streamline the process (also I could just learn to do all my CSS in an external file to begin with), but, whatever, I'm definitely going to use this. It's a start at least!

  • sinaimanOP 15 years ago

    Todo list:

    -Allow for URL entry

    -Option for putting the separate CSS directly into the head of the HTML document

    -Add a link href to the stylesheet in the HTML (and temporarily host the CSS on the server)

    -Preview of the page to make sure nothing got screwed up

    -Be able to download HTML/CSS files directly

    -Be able to have "smarter" class definitions...figure out any common properties between groups of generated classes and make just one class all those elements can refer to.

    That's just off the top of my head, I'm open to all suggestions and feedback!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection