简体   繁体   中英

Ant build how to exclude js which are not minified and include js files which are minified

  1. I have a lib folder. Which contain minifiyed, not minifyed js files as well as css files.
  2. I need to create a build script using ant which copy all the files to destination folder but which exclude all js, css files which are not minified.

  3. folder item will be like this:

  4. lib/abc.js and lib/abc.min.js

  5. I need only lib/min.js to be copied to destination folder.
  6. Please dont suggest me -<include name="**/lib/**/*.min.js" /> because my root contains lots of .html,.txt files which i need to copy to destination folder. I need something like include all and exclude this particular unminifyed files in the lib folder. I cant use <exclude name="**/lib/**/*.js" /> which exclude minifed JS also.

Finally created answer myself. will only copy minifyed js, css file from libs folder

<property name="dest" location="build_release/project" />
<target name="create package">
 <copy todir="${dest}">
        <fileset dir="public_html">
            <exclude name = "/js/libs/**"/>
            <exclude name = "/css/libs/**"/>
        </fileset>
        <fileset dir="public_html">
            <include name = "/js/libs/**/*.min.js"/>
            <include name = "/css/libs/**/*.min.css"/>
        </fileset>
    </copy>
</target>

Any doubts you can ask on comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM