Is it possible to include a javascript file that is in an archived file?

Just as we include javascript file in html

<script language="JavaScript1.2" src="CommonFunctions.js" type="text/javascript">

In this case, "CommonFunctions.js" is placed in the current directory. Can we include a javascript file that is inside an archived file?

+3
source share
3 answers

Some people want this functionality, but it is not currently supported.

I also do not find this very useful: if you archive all JS and CSS, how can you cache parts of them on the local machine? There is already gzip too, and minification.

, , , , , PNG.

+2

, - .

+1

No, you need to unzip the file in advance.

If you want to compress it before sending it to the browser, there are utilities for javascript compression (yui compressor, etc.), as well as gzip, which allows you to send compressed files over the Internet before reaching a web browser.

+1
source

Source: https://habr.com/ru/post/1724064/


All Articles