ymzuiku / parcel-plugin-change-file

parcel 的文件处理插件 \ Jump parcel bundler in html & Replace html string & Copy files at parcel builded
MIT License
16 stars 8 forks source link

Issues with parcel build when minifying #2

Open Jbcampbe opened 6 years ago

Jbcampbe commented 6 years ago

I can't get this plugin to work when minification is turned on. For example if I have.

<!DOCTYPE html>
<html>
  <body>
    <!--[ <script type="text/javascript" src="cordova.js"></script> ]-->
  </body>
</html>

and run parcel build index.html

then I get

<!DOCTYPE html><html> <body>  </body> </html>

But running parcel build index.html --no-minify

gives me the desired output.

<!DOCTYPE html>
<html>
  <body>
    <script type="text/javascript" src="cordova.js"></script>
  </body>
</html>
alterebro commented 5 years ago

Hi @Jbcampbe I came across the same issue, It can be avoided by creating a .htmlnanorc file:

{
  "removeComments": false
}