gulp-html-static

change url or replace url or add prefix url


License
ISC
Install
npm install gulp-html-static@1.0.1

Documentation

gulp-html-static

replace resources in html template.

Install

npm install gulp-html-static --save
git clone git@github.com:zhe-he/gulp-html-static.git

demo

npm run build

gulpfile

var gulp = require('gulp');
var static = require('gulp-html-static');

gulp.task('static', function () {
    return gulp.src('templates/**/*.html')
        .pipe( static({
            '/src/js/':  'http://static.xxx.com/src/js/',
            '/link/img/': 'http://static.xxx.com/img/',
            '/${': 'http://static.xxx.com/${',
            'other': function (str,index){
                return "/change/"+str;
            }

        }) )
        .pipe( gulp.dest('dist') );
});

Options

"/src/js/" => "http://static.xxx.com/src/js/"
"/link/img/" => "http://static.xxx.com/img/"
"/${" => "http://static.xxx.com/${"
"other" => "return string"

License

MIT © zhe-he