postxml-import
PostXML to import html files.
Installation
npm i postxml-import --save-dev
Usage
Options
selector
Query selector.
Type: String
Default: import[src]
attr
Attribute that contains path.
Type: String
Default: src
path
Function that get value of attr and returns absolute path to file.
Type: Function
Default:
{ return attr;}
Examples
Example 1 (Base syntas)
Input
(block.htm)
block.htm
Output
Example 2 (import width content)
Input
Content
(block.htm)
block.htm
Output
Content
Example 3 (Import component)
Options
selector: 'import[component]' attr: 'component' { return 'blocks/' + componentName + '/' + componentName + '.htm' }
Example 4 (Inline svg)
Input
Options
selector: 'img[src$=".svg"]' { return 'cwd/' + src }
Output
Licence
MIT