我正在液体模板中创建自己的 Shopify 主题。我安装了 laravel-elixir 和 gulp 来帮助结合我的 css 和 js 以及缩小我的 html。运行 gulp 时,我收到一条错误消息:
events.js:160
throw er; // Unhandled 'error' event
^
Error: Parse Error: <' | append: 'img' %}
{% if article.excerpt_or_content contains img_tag %}
我将<!-- htmlmin:ignore -->
标签放在错误点周围,我得到了同样的错误。在我的 gulp 文件中,我创建了一个 customAttrSurround,但我仍然遇到同样的问题。我试图让 htmlmin 忽略所有液体括号。任何帮助表示赞赏。
const elixir = require('laravel-elixir');
require('laravel-elixir-minify-html');
var liquidignore = [
'/\{\{.*\}\}',
'/\{\%.*\%\}',
];
elixir((mix) => {
mix.styles([
'../../../theme/bootstrap/css/bootstrap.css',
'../../../theme/plugins/magnific-popup/magnific-popup.css',
'../../../theme/css/animations.css',
'../../../theme/plugins/owl-carousel/owl.carousel.css',
'../../../theme/plugins/owl-carousel/owl.transitions.css',
'../../../theme/plugins/hover/hover-min.css',
'../../../theme/css/style.css',
'../../../theme/css/skins/light_blue.css'
], 'assets/app.css')
.scripts([
'../../../theme/plugins/jquery.min.js',
'../../../theme/bootstrap/js/bootstrap.min.js',
'../../../theme/plugins/modernizr.js',
'../../../theme/plugins/magnific-popup/jquery.magnific-popup.min.js',
'../../../theme/plugins/waypoints/jquery.waypoints.min.js',
'../../../theme/plugins/jquery.countTo.js',
'../../../theme/plugins/jquery.parallax-1.1.3.js',
'../../../theme/plugins/owl-carousel/owl.carousel.js',
'../../../theme/plugins/jquery.browser.js',
'../../../theme/plugins/SmoothScroll.js',
'../../../theme/js/template.js'
], 'assets/app.js')
.copy('assets', 'upload/assets')
.copy('config', 'upload/config')
.copy('layout', 'upload/layout')
.copy('snippets', 'upload/snippets')
.copy('templates', 'upload/templates')
.html('upload/snippets/*', 'upload/snippets', {collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, minifyJS: true, customAttrSurround: liquidignore})
.html('upload/templates/*', 'upload/templates', {collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, minifyJS: true, customAttrSurround: liquidignore})
.html('upload/layout/*', 'upload/layout', {collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, minifyJS: true, customAttrSurround: liquidignore})
});