【发布时间】:2017-01-20 11:51:12
【问题描述】:
我正在尝试将 JS 文件合并到一个文件中,但是我需要使用 js 文件中的 if 语句来设置条件。
我创建了 file.js.liquid,但它似乎不起作用;例如,我添加了一个测试:
{% if template contains 'index' %}
console.log('homepage loaded');
{% endif %}
我正在尝试做的事情的例子,当然还有很多我需要做的事情。
{% if settings.the_simpsons_enabled and settings.simpsons_video_enable %}
// video popup
$(".video-popup").videoPopup();
{% endif %}
条件语句在 scss.liquid 文件中也不起作用:
{% if template contains 'index' or template contains 'collection' or template contains 'product' %}
@import url("{{ 'owl.carousel.scss' | asset_url }}");
{% endif %}
任何想法为什么如果它不起作用或什至可能?我认为它是一个液体文件。
【问题讨论】:
-
你不能使用@import。
-
你为什么不直接连接 JS 并用 gulp 之类的东西缩小/连接 SASS?
标签: javascript css sass shopify liquid