I’m working on ant build for concatenating and minifying my javascript files. I have a separate property file that lists the js files and what order to load them. I’m using Mootools. When I run the following code in my build, all of my $$ are converted to $:
<loadfile property="js.files" srcFile="${basedir}/${dir.source}/javascript.files">
<filterchain>
<striplinecomments>
<comment value="#"/>
</striplinecomments>
<!-- this filter outputs lines delimited by "," -->
<tokenfilter delimoutput=","/>
</filterchain>
</loadfile>
<!-- create a place holder variable that we will append file contents to -->
<var name="concat.script.contents" value=""/>
<for list="${js.files}" param="file" delimiter=",">
<sequential>
<loadfile property="@{file}.script.contents" srcfile="${basedir}/${dir.static}@{file}"/>
<var name="concat.script.contents" value="${concat.script.contents}${@{file}.script.contents}"/>
<!-- output the file contents here, everything looks okay -->
<echo>${@{file}.script.contents}</echo>
</sequential>
</for>
<!-- output the final result, now all $$ have been converted to $. why? -->
<echo>${concat.script.contents}</echo>
I am fairly new with ant but nothing in the above code indicates to me that all $$ should be replaced with $.
It’s an Ant bug, probably.
Double dollar sign
$$used to be replaced by$in regular expressions – extra dollar sign is used as an escaping character.Concatenation function you’re using has a call to ant-regexps. And it is difficult to figure out where exactly ant-regexps are used because, apparently, you’re not using regexps explicitly. So, my guess is that concatenation function you’re using has an internal call to ant-regexps somewhere.
Try using another way of concatenation. Concat task, for example, might help you out.