ng2Client/gulpfile.js
// Copy publish files to "publish" folder
Copy publish files to "publish" folder
Copy publish files to " publish " folder
function publish(config) {
    return new Promise(function (resolve, reject) {
        var changed = require("gulp-changed"),
            publishDest = "./publish",
            publishSrc = [
            "./app/fonts/**/*",
            "./app/css/app.min.css",
            "./app/images/**/*",
            "./app/app.min.js",
            "./app/app.min.js.map",
            "./_app_offline.htm",
            "./favicon.ico",
            "./robots.txt"
            ];
        return gulp.src(publishSrc, { base: "./" })
            .on("error", promiseErrorHandler)
            .pipe(changed(publishDest))
            .pipe(gulp.dest(publishDest))
            .on("end", function () {
                var htmlReplace = require("gulp-html-replace");
                var version = require("./package.json").version;
                var appHtml = "./app.html";
                var webConfig = "./Web.config";
                return gulp.src([appHtml, webConfig])
                    .pipe(htmlReplace({
                        "app-html": {
                            src: "/app/app.min.js?v=" + version,
                            tpl: "<script async src=\"%s\"></script>"
                        }
                    }))
                    .on("error", promiseErrorHandler)
                    .pipe(gulp.dest(publishDest))
                    .on("end", resolve);
            });
    });
}
function publish ( config ) { return new Promise ( function ( resolve , reject ) { var changed = require ( "gulp-changed" ) , publishDest = "./publish" , publishSrc = [ "./app/fonts/**/*" , "./app/css/app.min.css" , "./app/images/**/*" , "./app/app.min.js" , "./app/app.min.js.map" , "./_app_offline.htm" , "./favicon.ico" , "./robots.txt" ] ; return gulp . src ( publishSrc , { base : "./" } ) . on ( "error" , promiseErrorHandler ) . pipe ( changed ( publishDest ) ) . pipe ( gulp . dest ( publishDest ) ) . on ( "end" , function ( ) { var htmlReplace = require ( "gulp-html-replace" ) ; var version = require ( "./package.json" ) . version ; var appHtml = "./app.html" ; var webConfig = "./Web.config" ; return gulp . src ( [ appHtml , webConfig ] ) . pipe ( htmlReplace ( { "app-html" : { src : "/app/app.min.js?v=" + version , tpl : "<script async src=\"%s\"></script>" } } ) ) . on ( "error" , promiseErrorHandler ) . pipe ( gulp . dest ( publishDest ) ) . on ( "end" , resolve ) ; } ) ; } ) ; }
Copy publish files to "publish" folder
Copy publish files to " publish " folder