2011-10-20 102 views
1

有没有过滤器,你能给我一个使用Phing删除一段代码的例子吗?Phing删除节过滤器

E.g.这是我的代码:使用Phing

function someFunc() { 
    doStuff(); 
} 

function someFunc() { 
    // <debug> 
    var_dump(func_get_args()); 
    // </debug> 
    doStuff(); 
} 

如何剥离下来到?

回答

0

我的工作了一个小的正则表达式:

<target name="stripblocks" depends="prepare,clone"> 
    <property name="stripblocks" value="debug|strict" /> 
    <reflexive> 
     <fileset dir="${buildpath}"> 
      <include pattern="**/*" /> 
     </fileset> 
     <filterchain> 
      <!-- Replace the blocks using regex --> 
      <replaceregexp> 
       <regexp pattern="//\s&lt;(${stripblocks})&gt;.*?//\s&lt;/(${stripblocks})&gt;" 
         replace="// &lt;$1/&gt;" 
         ignoreCase="true" 
         multiline="true" /> 
      </replaceregexp> 
     </filterchain> 
    </reflexive> 
</target> 

这改变

function someFunc() { 
    // <debug> 
    var_dump(func_get_args()); 
    // </debug> 
    doStuff(); 
} 

function someFunc() { 
    // <debug/> 
    doStuff(); 
}