Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4103230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:55:55+00:00 2026-05-20T20:55:55+00:00

I am about to create an apache ant target that compresses all my .js

  • 0

I am about to create an apache ant target that compresses all my .js files with gzip. For now I came up with the following:

<target name="compress-js" description="Compressed JS files">
    <echo>Compressing JS files...</echo>
    <apply executable="gzip" parallel="false">
        <arg value="-c" />
        <arg value="--best" />
        <srcfile />
        <arg value=">" />
        <targetfile suffix=".${extension}" />
        <fileset dir="${js.dir}" includes="**/*.js" />
        <mapper type="identity" />
    </apply>
    <echo>OK!</echo>
</target>

Reading the files works correctly but the generated targetfile has the wrong path.

Given ${js.dir} is: /var/htdocs/js
and I start my ant target in some other directory the script above produces the following shell command:

gzip -c /var/htdocs/js/a/b/1.js > ./a/b/1.js

which is not correct. The targetfile should get the same absolute path as the sourcefile. I want it to produce the following line:

gzip -c /var/htdocs/js/a/b/1.js > /var/htdocs/js/a/b/1.js

Can someone tell me how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:55:56+00:00Added an answer on May 20, 2026 at 8:55 pm

    Use something like =

    <tar destfile="./your.tar.gz" compression="gzip">
     <tarfileset dir="${js.dir}">
      <include name="**/*.js"/>
     </tarfileset>
     </tar>
    </target>
    

    see Ant manual for tar task

    Beside that there is also a wrapper task for the YUI Compressor Task, here’s some detailled description how to use it =
    Compress JavaScript and CSS as Part of your Build Process

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm about to create a web application that requires a lot of different web
I was thinking about how to create a program that would only be valid
I'm using python and CherryPy to create a simple internal website that about 2
I have a method that's about ten lines of code. I want to create
I am trying to write about 5 websites all on one Apache server which
In Java, we're using the following package to programmatically create excel documents: org.apache.poi.hssf If
I'm trying to create an Apache Camel route that sends a jms message to
I'm learning about table design in SQL and I'm wonder how to create a
I am thinking about the design of an iPhone app I'd like to create.
Thinking about my other problem , i decided I can't even create a regular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.