mergeScripts skip block?
spacedawwwg opened this issue · comments
Paul Welsh commented
Is there a way to use mergeScripts but skip a block?
use case: I have a <script>
in the head that needs to be in the head, but the rest of the script blocks can be merged
some kind of flag on the tag would be good maybe?
Kirill Maltsev commented
Sure. Just add some different class to it:
<html lang="en">
<head>
<script class="foob">alert(1)</script>
<script>alert(2)</script>
</head>
<body>
<script>alert(3)</script>
<script>alert(4)</script>
</body>
</html>
would get minified to
<html lang="en">
<head>
<script class="foob">alert(1);</script>
</head>
<body>
<script>alert(2),alert(3),alert(4);</script>
</body>
</html>
Let me know if this works for your use-case!