Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
How to recursively fetch nested relative style sheets using JavaScript

If I am on a web page, we can get entire html source code by

document.querySelector('html')

I can also download the necessary styles by iterating over styleSheets Object like

for (var sheet= 0; sheet<document.styleSheets.length; sheet++) {

But the issue I am facing is they have recursively nested links in them , like

url("../fonts/fa-regular.woff2") format("woff2")

How can I access them and download them locally so that I can serve from my local using JavaScript?

I want to download all the css and js dependencies and serve from my server/local Can it be done? Please guide

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think the best (and right) solution would be to use Node.js

  • make fetch to get html data from the sorce
  • create regx to retriev all needed paths. collect all of them into array
  • make function to get data from paths and chek, if responce has some path inside (to fonts e.g.), call function again (recursively)
  • store data ;)

Best regards!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!