gulp-concat-js-document-write
v1.0.1
Published
a gulp plugin, concat `document.write` in js file for one
Downloads
6
Maintainers
Readme
gulp-concat-js-document-write
Quick Start
1.Installation
$ npm install --save gulp-concat-js-document-write
2.Usage
My js file is combo.js
, '/resource/js/combo/src/combo.js' is relative path at website's root.
(function() {
var srcPath = '/resource/js/';
document.write('<script src="' + srcPath + 'b.js"><\/script>');
document.write('<script src="' + srcPath + 'c.js"><\/script>');
document.write('<script src="' + srcPath + 'd.js"><\/script>');
}());
In my gulp file written like this:
let concatDocumentWrite = require('gulp-concat-js-document-write')
let rootPath = 'website/root/absolute/path'
let jsSrc = 'the/path/is/resource/js/combo/src'
let jsDest = 'the/path/is/resource/js/combo/dest'
gulp.task ('js', function () {
gulp.src (jsSrc+'/**/*.js')
.pipe (concatDocumentWrite ({
rootPath : rootPath
}))
.pipe (gulp.dest (jsDest))
})