Copy NPM module/library to distribution folder using Gulp
<p>Most web applications these days include various prebuilt libraries e.g. Backbone.js. </p>

<p>I want, when I compile my web application with Gulp, to output a single compressed JavaScript file of the library/module I installed using NPM e.g. <code>backbone-min.js</code>.</p>

<p>For example, when you install Backbone.js from NPM the following is installed into the <code>node_modules</code> folder:</p>

<pre><code>.
├── backbone
│   ├── LICENSE
│   ├── README.md
│   ├── backbone-min.js
│   ├── backbone-min.map
│   ├── backbone.js
│   └── package.json
</code></pre>

<p>I want to be able to run <code>gulp compile</code> and get the following result in my web application distribution folder:</p>

<pre><code>.
├── index.html
├── scripts
│   ├── backbone-min.js // this is the file I want to copy or generate
│   ├── main.min.js
</code></pre>

<p>The way I see it Gulp either needs to either:</p>

<ul>
<li>compile and minify the library/module and write it to a file called <code>backbone-min.js</code> to the <code>scripts</code> folder, or </li>
<li>copy the <code>backbone-min.js</code> in the backbone module folder to the <code>scripts</code> folder.</li>
</ul>

<p>What is the best way of doing this?</p>