我在液体模板中创建自己的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})
});