/    Sign up×
Community /Pin to ProfileBookmark

Compress and merge multiple JS files using Shrinksafe

Dear All,

I need to compress and merge multiple JavaScript files (in a particular folder) to a single file using Shrinksafe. I’m able to merge the files to a single one using the below command.

java -jar shrinksafe.jar *.js > testMin.js

The problem with this is that, it does not put all the script in a single line. It just removes the comments.

Also I need to achieve the same task using ant build script.

I tried the below approach

[CODE] <target name=”compress-js”>
<echo message=”Starting JS compress Build”/>
<java fork=”true” dir=”${shrinksafe.util.path}/buildscripts” classname=”org.mozilla.javascript.tools.shell.Main”>
<arg value=”build.js”/>
<arg line=”releaseDir=../../../../../../StaticFiles/acb profile=acb_js action=clean,release *.js > acb.js” />
<classpath>
<pathelement location=”${shrinksafe.util.path}/shrinksafe/js.jar”/>
<pathelement location=”${shrinksafe.util.path}/shrinksafe/shrinksafe.jar”/>
<pathelement path=”${java.class.path}”/>
</classpath>
</java>
<echo message=”js build successfull.” />
</target>[/CODE]

I’m not sure if I can achieve my requirement using the above script. The is the dojo profile that I’m using.

[CODE] //Below code is from acb-js.profile.js file.
dependencies = {
layers: [
{
name: “../gp-js.js”,
resourceName:”gp-js”,
dependencies: [
]
}
],
prefixes: [
[“scripts”, “../../StaticFiles/acb/homepage”]
]
};[/CODE]

My JavaScript files are inside `StaticFiles/acb/homepage` folder.

Please help me.Thanks in advance. Any help will be greatly appreciated.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @AppsWorld spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...