I have the following block that starts and ends with HTML comments:
<!--source scripts-->
<script type="text/javascript" src="/assets/js/namespaces.js"></script>
<script type="text/javascript" src="/assets/js/main.js"></script>
<script type="text/javascript" src="/assets/js/header.js"></script>
<script type="text/javascript" src="/assets/js/headerPremiumForm.js"></script>
<script type="text/javascript" src="/assets/js/bootstrap.js"></script>
<!--end source scripts-->
I created an ant task that finds everything between the <!--source scripts--><!--end source scripts-->
and replaces it with a new script file (in this case min.js), but I have trouble making it work.
This is what I've done so far:
<target name="update-source-with-new-compiled-files">
<replaceregexp match="\<!--source scripts--\>(.*?)\<!--end source scripts--\>" replace="\<script src='min.js'\>\</script\>" flags="g">
<fileset dir="${basedir}/../dist" includes="*"/>
</replaceregexp>
</target>
Just add the s flag to your flags :
<replaceregexp match="\<!--source scripts--\>(.*?)\<!--end source scripts--\>" replace="\<script src='min.js'\>\</script\>" flags="gs">
<fileset dir="${basedir}/../dist" includes="*"/>
</replaceregexp>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With