include needed files of a html file to a specific folder
Packing all needed images, scripts, stylesheets in a html file and save it to a directory.
If you are trying to copy all the files that a html needs to a new directory. You can use
include to help you deal with this problem.
include is a package, which can pack ONLY the scripts and styles a specific html, here is a following example.
include index.html -o files,
include will create a new directory that save all
index.html needs. Like
script/script2.js. As a result, the final folder
files will bild a file structure like the following source tree.
files ------- index.html|---- script ------ script.js|---- script2.js
The reason building this repository is that if I want to wrapped a html file you need. You can hardly know what the exactly files the html needed, might be some
.css files or images, fonts. In the past, you would probably copied the whole images, scripts, stylesheets folder.
include help you find out what is needed in the specific html file, and make a copy to a output folder. This could help you a lot if you are trying to deploy a specific html file.
The repository create a local server at port
4444 (so you shouldn't use the port), and use
phantomjs to request the local server and find out what files the html need.
npm install include-html
var include = ;
This will copied all the files (images, scripts, styles) that
./html/index.html file needs and copied to
includewill automatically make the folder for you. (absolute route)
Usage: include [options] <source to your html, default ./index.html>Options:-h, --help output usage information-V, --version output the version number-o, --output <directory> Path to output directory, defaults to current directory-p, --port <port number> Port which your local server start.
include ./test/index.html -o output-test-folder
include will magically packed your
image files, to the output folder that you entered.