How to replace Javascript of production website with local Javascript?

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

On my production website, I have compiled Javascript.


It would be very convient for

6条回答
  •  我在风中等你
    2020-12-01 02:15

    Add something to your URL to distinguish between your dev and prod context ; example : http://url_of_prod.com

    http://url_of_dev.com?debug=true

    and then, use some javascript to check if the GET variable debug is ON or NOT or check the URL with
    if (window.location.host.indexOf(‘url_of_dev’) > -1) ...

    THEN USE a load function to load or not your file, as in this example : http://www.softpeople.fr/replaceswitch-dev-local-production-website-javascript-during-debug/

提交回复
热议问题