Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You probably want to generate the replace text first, by processing the directory containing the .js files.</p> <p>One approach might be to use a <a href="http://ant.apache.org/manual/Types/fileset.html" rel="nofollow"><code>fileset</code></a> to gather the names of the files, then a <a href="http://ant.apache.org/manual/Tasks/pathconvert.html" rel="nofollow"><code>pathconvert</code></a> task to construct the html snippet to use a replacement text. For a directory 'my_dir', for example:</p> <pre><code>&lt;fileset id="dir.contents" dir="my_dir"&gt; &lt;include name="*.js"/&gt; &lt;/fileset&gt; &lt;pathconvert pathsep="${line.separator}" property="js.html" refid="dir.contents"&gt; &lt;chainedmapper&gt; &lt;mapper type="flatten" /&gt; &lt;regexpmapper from="(.*)" to='&amp;lt;script type="text/javascript" src="http://your.url/\1"&amp;gt;&amp;lt;/script&amp;gt;' /&gt; &lt;/chainedmapper&gt; &lt;/pathconvert&gt; &lt;echo&gt;${js.html}&lt;/echo&gt; </code></pre> <p>The <code>flatten</code> removes the directory part of the file path, leaving just the file name.</p> <p>The echo then yields something like:</p> <pre><code> [echo] &lt;script type="text/javascript" src="http://your.url/a.js"&gt;&lt;/script&gt; [echo] &lt;script type="text/javascript" src="http://your.url/b.js"&gt;&lt;/script&gt; [echo] &lt;script type="text/javascript" src="http://your.url/c.js"&gt;&lt;/script&gt; </code></pre> <p>So, you can then use <code>${js.html}</code> as your regexp replace text.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload