Bootstrap trying to load map file. How to disable it? Do I need to do it?

前端 未结 13 992
情书的邮戳
情书的邮戳 2020-12-04 09:59

I\'m recently playing with bootsrap3. I compiled it from sources and included distr js and css to my project. The thing is, I see in GH dev tools, that it\'s trying to get .

相关标签:
13条回答
  • 2020-12-04 10:30

    This only happens when you use the dev-tools, and won't happen for normal users accessing the production server.

    In any case, I found it useful to simply disable this behavior in the dev-tools: open the settings and uncheck the "Enable source maps" option.

    There will no longer be an attempt to access map files.

    0 讨论(0)
  • 2020-12-04 10:34

    Delete the line /*# sourceMappingURL=bootstrap.css.map */ from bootstrap.css

    0 讨论(0)
  • 2020-12-04 10:34

    If you don't have the correct .map file and you don't want to edit lines in bootstrap.css you can create a dummy .map file.

    In my case I was seeing the error:

    GET /bootstrap.css.map not found.
    

    So I created an empty bootstrap.css.map in the /public directory and the error stopped.

    0 讨论(0)
  • 2020-12-04 10:40

    I had also warnings in Google Dev-Tools and I added only bootstrap.min.css.map file in the same folder, where bootstrap.min.css is.

    I have now no warnings more and You can find more Explanation here: https://github.com/twbs/bootstrap#whats-included

    I hope, I answered your Question.

    0 讨论(0)
  • 2020-12-04 10:41

    .map files allow a browser to download a full version of the minified JS. It is really for debugging purposes.

    In effect, the .map missing isn't a problem. You only know it is missing, as the browser has had its Developer tools opened, detected a minified file and is just informing you that the JS debugging won't be as good as it could be.

    This is why libraries like jQuery have the full, the minified and the map file too.

    See this article for a full explanation of .map files:

    0 讨论(0)
  • 2020-12-04 10:45

    Delete /*# sourceMappingURL=bootstrap.min.css.map */ in css/bootstrap.min.css

    and delete /*# sourceMappingURL=bootstrap.css.map */ in css/bootstrap.css

    0 讨论(0)
提交回复
热议问题