posthtml-insert-at
posthtml-insert-at
is a PostHTML plugin to append or prepend HTML to a selector.
Examples
Before:
After:
Install
yarn add -D posthtml-insert-at# OR npm i posthtml-insert-at
Usage
const fs = ;const posthtml = ;const insertAt = ; const html = fs; ;
Options
Name | Kind | Description |
---|---|---|
selector |
required string |
Selector to insert markup at (e.g. .classname , #id or tag ) |
prepend |
optional string |
Markup to prepend to the selector |
append |
optional string |
Markup to append to the selector |
behavior |
optional ("inside" or "outside" ) - default is "inside" |
Whether to append/prepend content inside or outside of the selector |
The plugin accepts an object or an an array of objects.
const option = selector: 'body' prepend: '<header></header>' append: '<footer></footer>' behavior: 'inside'; ;// OR;
Limitations
Currently, this plugin does not supported nested selectors.
Contributing
See the PostHTML Guidelines.