Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复一个正则匹配错误 #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ValorLin
Copy link

如下 html 代码

<script>console.log('yo')</script><script src="js/export.js?__inline=true"></script>

原有的正则表达式会匹配整行,而导致第一个 script 标签被错误地删除。
现在使用[^>]+?代替.+?保证只匹配>符号之前的内容。

@ValorLin
Copy link
Author

ValorLin commented Mar 3, 2015

@chyingp 求解决,因为我是先压缩 html 文件,再进行 grunt-inline 的。
这样会导致很多 <script> 标签在同一行中,由于这个 bug 的存在,正则表达式匹配错误会丢失一些内容。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant