Groups | Search | Server Info | Login | Register


Groups > alt.comp.software.seamonkey > #8442

Re: Purge *ALL* CSS from an HTML document

From Dirk Fieldhouse <surname@gmx.net.plusremovethisandtherest.invalid>
Newsgroups alt.comp.software.seamonkey
Subject Re: Purge *ALL* CSS from an HTML document
Date 2026-02-12 14:38 +0000
Organization speaking personally
Message-ID <10mkoka$2kqs$1@solani.org> (permalink)
References (3 earlier) <10lgjml$1kknd$1@dont-email.me> <878qd15896.fsf@enoch.nodomain.nowhere> <10mfck9$3m3ka$1@dont-email.me> <10mgvac$7eqd$1@dont-email.me> <10mi75f$ncc4$1@dont-email.me>

Show all headers | View raw


On 11/02/2026 15:27, Richard Owlett wrote:>...>
> I have ANOTHER project for which I want a CSS free HTML file.
> ...
Do you want:
1.	no CSS syntax at all?
2.	to strip out all mention of the external CSS?
3.	that, but to have the same styles applied within the HTML document?

For 3, put the content of the CSS file inside <style
type="text/css">...</style> (the type attribute is needed in HTML4), say
just before the closing "</head>". See also
<https://stackoverflow.com/questions/28258579/modify-html-file-to-embed-all-external-scripts-and-css-into-script-and-style>.

For 2, remove any <link ... rel="stylesheet" ...> element whose href
attribute matches the unwanted CSS file (or just any such element).

For 1, do 2 and also remove all <style> elements and style= attributes.

Having identified which option applies, you could formulate a command
using (eg) sed, or teco if you have it, that implements the desired
change. The linked SO suggests the BeautifulSoup Python module which
would be a more correct way of manipulating HTML than regular expression
search-and-replace.

Then (assuming that, as I understand, OP is a Linux user) you could use
the xargs command, or a POSIX shell "for" loop, to apply the command to
each of the 1400 files. You may have time for a cup of tea while that runs.

/df

-- 
London
UK

Back to alt.comp.software.seamonkey | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-01-29 08:40 -0600
  Re: Purge *ALL* CSS from an HTML document "David E. Ross" <nobody@nowhere.invalid> - 2026-01-29 08:09 -0800
    Re: Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-01-29 12:08 -0600
  Re: Purge *ALL* CSS from an HTML document Schugo <schugo@schugo.de> - 2026-01-29 20:08 +0100
    Re: Purge *ALL* CSS from an HTML document Schugo <schugo@schugo.de> - 2026-01-29 20:13 +0100
      Re: Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-01-29 15:33 -0600
        Re: Purge *ALL* CSS from an HTML document Mike Spencer <mds@bogus.nodomain.nowhere> - 2026-02-10 04:10 -0400
          Re: Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-02-10 07:42 -0600
            Re: Purge *ALL* CSS from an HTML document "Paul B. Gallagher" <mozilla@pbg-translations.com> - 2026-02-10 23:07 -0500
              Re: Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-02-11 09:27 -0600
                Re: Purge *ALL* CSS from an HTML document Dirk Fieldhouse <surname@gmx.net.plusremovethisandtherest.invalid> - 2026-02-12 14:38 +0000
                Re: Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-02-13 08:29 -0600
                Re: Purge *ALL* CSS from an HTML document Schugo <schugo@schugo.de> - 2026-02-13 16:50 +0100
                Re: Purge *ALL* CSS from an HTML document Richard Owlett <rowlett@access.net> - 2026-02-14 05:04 -0600
                Re: Purge *ALL* CSS from an HTML document Schugo <schugo@schugo.de> - 2026-02-16 18:28 +0100
        Re: Purge *ALL* CSS from an HTML document Nuno Silva <nunojsilva@invalid.invalid> - 2026-03-02 08:46 +0000

csiph-web