JavaScript build process using Ant

Written by on March 9th, 2009 in Uncategorized.

Johan “Spocke” Sörlin of Moxiecode has written an article on a build process that uses Ant to munge JavaScript.

The preprocessor lives in the open source js build tools project and allows you to do C-style ifdef type work:

JAVASCRIPT:

  1.  
  2. // #ifdef somedefine
  3.  
  4. someLogic();
  5.  
  6. // #endif
  7.  
  8. someOtherLogic();
  9.  

You can tie this together with Ant by using some custom rules to process and then compress:

XML:

  1.  
  2. <preprocess infile=“file.js” outfile=“file.processed.js” defines=“somedefine,someotherdefine” />
  3.  
  4. <yuicompress infile=“file.js” outfile=“file.min.js” />
  5.  

Source: Ajaxian » Front Page
Original Article: http://feedproxy.google.com/~r/ajaxian/~3/eeOxAuzR8Nk/javascript-build-process-using-ant

Comments are closed.



Site Navigation