Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you happen to be using something based on connect (e.g. express), I'd recommend using <a href="https://github.com/TrevorBurnham/connect-assets" rel="nofollow">connect-assets</a>. If not, then <a href="http://gruntjs.com/" rel="nofollow">grunt</a> may be a good bet, as was previously suggested. If you'd like to do this yourself using a <code>Cakefile</code>, here is one approach you could use:</p> <p>Note that the convention is to build from src to lib (which is the reverse of what you stated in the question). I'll use that convention below, but you can easily switch it back if needed.</p> <p><code>$ npm install snockets</code></p> <p>place the following in <code>src/awesomefile.coffee</code>:</p> <pre><code>#= require secondfile.js #= require myfile.js.coffee </code></pre> <p>create a <code>Cakefile</code> with the following:</p> <pre><code>fs = require 'fs' Snockets = require 'snockets' NAME = 'awesomefile' INPUT_FILE = "src/#{NAME}.coffee" OUTPUT_FILE = "lib/#{NAME}.min.js" task 'build', 'Build lib/ from src/', -&gt; snockets = new Snockets() js = snockets.getConcatenation INPUT_FILE, async: false, minify: true fs.writeFileSync OUTPUT_FILE, js task 'clean', "remove #{OUTPUT_FILE}", -&gt; fs.unlinkSync OUTPUT_FILE </code></pre> <p>Now you can just do:</p> <p><code>$ cake build</code></p> <p>and that will create a <code>lib/awesomefile.min.js</code>.</p> <p>You can have the files in <code>src</code> track their own dependencies, or you can list the order to be included in a single file like I've done above. For more, you can check out the <a href="https://github.com/TrevorBurnham/snockets" rel="nofollow">snockets</a> repository. Also note that the <a href="http://arcturo.github.com/library/coffeescript/05_compiling.html" rel="nofollow">compiling chapter</a> chapter of <a href="http://arcturo.github.com/library/coffeescript/" rel="nofollow">The Little Book on CoffeeScript</a> is a good resource for learning about cake files.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload