copia
Node.js library to copy assets located on the node_modules
directory to the destination defined in the index.html
.
Quick Start
Download the latest version
npm install --save-dev copia
Require copia
:
var cp = require('copia');
Define the location of your node_modules
folder and the index.html
file:
var config = {"index-html": "./src/index.html", "node-modules": "./node_modules"};
Invoke copia
with the config
object defined above:
cp.copia(config);
Copia will walk the node_modules
directory structure and automatically copy all the assets (css and js) defined in your index.html
:
The following reference on index.html
...
<link rel="stylesheet" href="public/css/codemirror.css">
... will be copied from node_modules
to the actual location referenced above:
public
css
codemirror.css
Same for any script file:
<script src="public/js/codemirror.js"></script>
public
js
codemirror.js
Todo
- Ignore resolving list of files (e.g.
var config = {... "ignore":["app.css", "app.js"]};
) - Create dirs if they don't exist