srmaind
srmaind

Reputation: 23

How can I include the CSS or JS files from a ZIP folder in my HTML page?

I have a zipped folder of all the CSS and JS files for my desktop Electron application. I am trying to refer a CSS file from this zip using the below syntax which isn't working:

<link rel="stylesheet" type="text/css"
  href="../css/resources.zip/assets/styles/style.min.css">

Is this even possible or am I making some syntax errors?

Upvotes: 0

Views: 3155

Answers (3)

spennybuns
spennybuns

Reputation: 247

You can put your css into the html file

<style>
  h1 {
    color:black;
  }


</style>

Unfortunately, this can crowd up your html file, but it gets the job done. Minifying can help with the crowd problem.

Upvotes: 0

Sean
Sean

Reputation: 1464

You could do this by using a package like adm-zip.

You could open the zip using this and get the files you want and just add the file content to your page using fs. Its not the best method but it is possible.

Like @domdom said you could just unzip it.

Upvotes: 0

Zoom
Zoom

Reputation: 464

I don't think it's possible without extensions. A zipped folder is rather a file than a directory, a folder with items not accessible by normal means.

Upvotes: 1

Related Questions