我正在使用Google的Web Starter Kit开发网站。当我运行gulp来观看本地更改时,所有文件似乎都正常工作,包括Magnific Pop-Up。当我部署到服务器并且弹出式JavaScript文件刚刚消失而某些HTML失效时,问题就开始了。
我一直试图找到解决方案,但我被困在同一个地方,任何帮助都表示赞赏。如果您需要任何代码,文件或屏幕截图,请告诉我。
这是layout.njk,其中在元和正文中引用了CSS和JavaScript:
<meta charset="utf-8">
<!-- Your styles -->
<link rel="stylesheet" href="/styles/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css">
{% block headincludes -%}{%- endblock %}
{% block body -%}
<div class="c-site__frame">
{% include 'partials/_header.njk' %}
<div class="c-site__content">
{% block main %}{% endblock main %}
</div>
</div>
{%- endblock body %}
{%- block bottomincludes %}{%- endblock bottomincludes %}
<!-- build:js /scripts/main.min.js -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="/scripts/libs/swiper.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script>
<script src="/scripts/libs/magnific-popup/jquery.magnific-popup.min.js"></script>
<script src="/scripts/main.js"></script>
<!-- endbuild -->
<!-- Built with love using Web Starter Kit -->