By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,751 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Tool to group STYLE tags together?

P: n/a
I am using an application that dynamically creates style tags all over the
place in the html file. I mean some inside the head section and some in the
body section. I have no control over this.

Is there a tool/utility out there which reads in such a file, moves all the
STYLE tags and groups them together in the head section or an external
file? (Just grouping them is fine with me)

John Dalberg
Nov 3 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

John Dalberg wote:
I am using an application that dynamically creates style tags all over the
place in the html file. I mean some inside the head section and some in the
body section. I have no control over this.

Is there a tool/utility out there which reads in such a file, moves all the
STYLE tags and groups them together in the head section or an external
file? (Just grouping them is fine with me)

John Dalberg
If you have a program that uses HTML-Tidy, like HTML-Kit
<http://www.chami.com/html-kit/you can clean it up that way.
Personally, I prefer TopStyle <http://www.bradsoft.com/top-style/>. If
also has a means to clean up external stylesheets and get everything
ordered.

--
Adrienne Boswell at work
Administrator nextBlock.com
http://atlas.nextblock.com/files/
Please respond to the group so others can share

Nov 3 '06 #2

P: n/a
John Dalberg wrote:
I am using an application that dynamically creates style tags all
over the place in the html file.
What is that application? Do you have an URL for the files?
I mean some inside the head section
and some in the body section. I have no control over this.
Is there a tool/utility out there which reads in such a file, moves
all the STYLE tags and groups them together in the head section or an
external file? (Just grouping them is fine with me)
I cann't imagine there is such a tool. Maybe a search&replace can replace
the inline styles with classes.

--
Nico Schuyt
http://www.nicoschuyt.nl/
Nov 4 '06 #3

P: n/a
John Dalberg wrote:
I am using an application that dynamically creates style tags all over
the place in the html file. I mean some inside the head section and some
in the body section. I have no control over this.
Do you mean style *elements* or style *attributes*? Style *elements* look
something like this:

<style type="text/css">
...
</style>

whereas style attributes look like this:

style="..."

It really helps if you use the correct terminology, as the answers may be
different for each interpretation.

In the case of <styleelements, it should be relatively easy to
post-process the page (using e.g. regular expressions in PHP) to merge
pull out the CSS from several style blocks and concatenate them into one.

In the case of style attributes on other elements, things get a bit more
tricky. It could also be done with a bit of scripting, but would require
more work.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Nov 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.