How to replace Javascript of production website with local Javascript?

前端 未结 6 2169
礼貌的吻别
礼貌的吻别 2020-12-01 01:41

On my production website, I have compiled Javascript.


It would be very convient for

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 01:58

    What about using a subdomain like http://static.example.comfor static files (e.g. .js files), and changing the hostfile?

    
    

    Add the following line to the hostfile (/etc/hosts for Linux, C:\WINDOWS\System32\drivers\etc\host):

    static.example.com 127.0.0.1
    

    Of course you've to run a server with the files from http://static.example.com/ on 127.0.0.1.

    Another solution is using a (local) proxy server like Privoxy for redirecting http://example.com/js/ to http://localhost/js/.

提交回复
热议问题