javascript - Ant Regex Replace pattern with contents of file -
i'm trying figure out how replace matching text in files contents of file. want inline javascript sources html. loadfile
doesn't work in replaceregexp
.
<replaceregexp flags="gs"> <regexp pattern="\<!--js--\>(.*?)\<!--/js--\>"/> <substitution expression='\<script src="min.js"\>\</script\>'/> <loadfile property="min.js" srcfile="compiled/min.js"/> </replaceregexp>
here's example of using <replaceregexp>
replace every <!--js-->***<!--/js-->
contents of min.js.
<project name="ant-replaceregexp" default="run" basedir="."> <target name="run"> <property name="js.pattern" ><![cdata[[<]!--js--[>](.*?)[<]!--/js--[>]]]></property> <loadfile property="min.js" srcfile="compiled/min.js"/> <replaceregexp file="test.html" flags="gs"> <regexp pattern="${js.pattern}"/> <substitution expression="${min.js}"/> </replaceregexp> </target> </project>
Comments
Post a Comment