1.0.1 • Published 7 years ago

gulp-concat-js-document-write v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

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))
})