An API to import fragmented files within other.
Node support: 0.10.x, 0.11.x
var dynamic = require('dynamic-api');
var contentCompiled = dynamic(path, content, opt);
Install dynamic-api with npm:
$ npm install dynamic-api
You can require the module:
var dynamic = require('dynamic-api');
Return a string of file compiled:
dynamic( path, content [, opt] )
paths = array de path relative
ignoreRepeated = boolean for ignore file repeated or not, default true
track = boolean for track path file or not, default false
debug = boolean for import file only debug or not, default false
Example:
dynamic( path, content, {
paths: [__dirname + '/directory'],
ignoreRepeated: false,
track: true,
debug: true
});
Import file on .js:
//import("path/file.js");
//import("file2.js");
Import file on .js only when debug:
//import("path/file.js")debug;
Import file on .html:
<!--import("path/file.html")-->
<!--import("file2.html")-->
Import file on .html only when debug:
<!--import("path/file.html")debug-->
Import file on .css:
/*import("path/file.css")*/
/*import("file2.css")*/
Import file on .css only when debug:
/*import("path/file.css")debug*/
Import file on a file any:
!import("path/file.txt")
!import("file2.txt")
Import file on a file any only when debug:
!import("path/file.txt")debug
To contribute to dynamic-api, clone this repo locally and commit your code.
Please check that everything works before opening a pull-request.
Dynamic-api is licensed under the MIT License