# gulp-insert-string-into-tag **Repository Path**: jae/gulp-insert-string-into-tag ## Basic Information - **Project Name**: gulp-insert-string-into-tag - **Description**: gulp插入字符串到指定标签之间的插件 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-07-18 - **Last Updated**: 2021-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## 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 String This is other String ``` ### 输出结果 `dist/index.html` ```html This is String append string prepend string This is other String ``` ## API ### Function 方法 - insertString.append(opts) 追加字符串到标签之间的最后面 - insertString.prepend(opts) 追加字符串到标签之间的最前面 ### opts 选项 - startTag 开始标记,可以是任意字符串 - endTag 结束标记,可以是任意字符串 - string 待追加的字符串