Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jae-jae/gulp-insert-string-into-tag
gulp插入字符串到指定标签之间的插件
https://github.com/jae-jae/gulp-insert-string-into-tag
Last synced: about 1 month ago
JSON representation
gulp插入字符串到指定标签之间的插件
- Host: GitHub
- URL: https://github.com/jae-jae/gulp-insert-string-into-tag
- Owner: jae-jae
- Created: 2017-05-19T06:19:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-19T07:27:03.000Z (over 7 years ago)
- Last Synced: 2024-10-29T20:17:47.515Z (about 2 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gulp-insert-string-into-tag
gulp插入字符串到指定标签之间的插件## 安装
```
npm install gulp-insert-string-into-tag
```## 用法
`gulpfile.js`
```javascript
var gulp = require('gulp');
var insertString = require('gulp-insert-string-into-tag');gulp.task('default', function () {
return gulp.src('index.html')
.pipe(insertString.append({
startTag:'',
endTag:'',
string:'append string'
}))
.pipe(insertString.prepend({
startTag:'',
endTag:'',
string:'prepend string'
}))
.pipe(gulp.dest('dist'));
});
```
`index.html`
```html
This is StringThis is other String
```
### 输出结果
`dist/index.html`
```html
This is Stringappend string
prepend string
This is other String
```
## API
### Function 方法
- insertString.append(opts) 追加字符串到标签之间的最后面
- insertString.prepend(opts) 追加字符串到标签之间的最前面### opts 选项
- startTag 开始标记,可以是任意字符串
- endTag 结束标记,可以是任意字符串
- string 待追加的字符串