Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7957145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:12:19+00:00 2026-06-04T04:12:19+00:00

I have a lot of html files with custom style sheets within. I would

  • 0

I have a lot of html files with custom style sheets within. I would like to create one universal style sheet that they all can use.
So what i need to do is replace

< style type=”text/css”>

.Title {….
.body {..

< /style>

including the tags with this in multiple html files.

< link media=”screen” href=”style.css” type=”text/css” rel=”stylesheet” />

Im sure someone has ran into this problem and im wondering what would be the easiest way to accomplish this task? is there some kind of applescript or php script i can run to do this or is there another way of doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:12:20+00:00Added an answer on June 4, 2026 at 4:12 am

    I’d usually just use TextMate’s Search in Project or some Ruby or shell script. I have a script like this saved as ggsub.rb and just modify it when I need to replace something in multiple files.

    #!/usr/bin/env ruby -Ku
    
    # paths = `find ~/Sites -name '*.html'`.chomp.split("\n")
    paths = Dir["*.html"]
    
    paths.each do |path|
      html = File.read(path)
      html.sub!(/<style.*?>.*?<\/style>/m,
      "<link rel=\"stylesheet\" href=\"style.css\">")
      puts html
      # File.open(path, "w") { |f| f.puts(html) }
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two files: master/newsletter1/file.html master/newsletter2/file.html newsletter1/file.html has a lot of new changes that
I have a lot of html files that I want to add a rel=nofollow
I have a lot of php/html files with many strings that should be internationalized
I have a lot of html files look like this: <font face=Garmond,Helvetica,Times size=2 color=#330066>
I have a lot of files such as JavaScript, HTML, and even C and
I have a lot of web pages that use the same exact html structure.
I have an HTML page with lot of tables. Among that I have a
I would like to use Sharepoint Designer 2007 as an html editor. I have
Here's the situation: I have a lot of HTML files, and these HTML files
I have a lot of HTML pages that need the same few lines of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.