insert2
Insert string into HTML.
Last updated 4 years ago by kchan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install insert2 
SYNC missed versions from official npm registry.

insert2 NPM version NPM downloads Build Status

Insert string into HTML.

Install

$ npm install --save insert2

Usage

import insert from 'insert2'

const html = `
<html>
  <head>
    <title>hi</title>
  </head>
  <body>
  </body>
</html> 
`

insert(html, {
  string: '<link rel="stylesheet" href="style.css" />',
  el: 'head'
})

// returned
<html>
  <head>
    <title>hi</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
  </body>
</html> 

API

insert2(html, options)

html

Type: string
Default: ''

The original HTML string.

options

string

Type: String
Default: ''

The string to be inserted into HTML.

el

Type: String
Default: body

HTML tag name, the place to insert into.

type

Type: String
Default: append

append or prepend.

insertMulti(html, options: Array<object>)

Like insert2() but uses a list of options to do multiple insertions.

import {insertMulti} from 'insert2'

License

MIT © EGOIST

Current Tags

  • 1.0.1                                ...           latest (4 years ago)

3 Versions

  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (7)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |