aui / art-template-loader

art-template loader for webpack
MIT License
107 stars 33 forks source link

如何去掉多余的换行符 #27

Open re54k opened 6 years ago

re54k commented 6 years ago

按照正常的HTML格式书写,build 之后输出内容里含有 “\n”,其实这个是不需要的,有什么方式移除掉么?

<footer>{{h}}</footer>
{{if h}}
<div>test</div>
{{/if}}

输出

return n+="<footer>",n+=t,n+="</footer>\n",t&&(n+="\n<div>test</div>\n"),n+="\n"}}
aui commented 6 years ago

开启压缩功能后,这些都不会存在的

re54k commented 6 years ago

感谢回复,目前使用的是 webpack 2.7,对应的rules 配置如下,但并没有消除掉换行符,是否使用的方式不对?

{
    test: /\.art$/,
    loader: 'art-template-loader',
    options: {
        minimize: true,
        htmlMinifier: true,
        htmlMinifierOptions: {
          collapseWhitespace: true,
          minifyCSS: false,
          minifyJS: false
        },
      }
  }
aui commented 6 years ago

你可以看下文档 debug 参数的描述

leadscloud commented 5 years ago

debug 设置为 false 仍然无法解决上面的问题

aui commented 5 years ago

最好提供一份 demo,以便与解决问题