javascript - How to concat & minify an angular2 application? -


i concat & minify angular2 application. did first concatenating *.js files (boot.js, application.js components) in 1 file , injected index.html. deleted

<script>         system.config({             packages: {                 app: {                     defaultextension: 'js'                 }             }         });         system.import('app/boot')             .then(null, console.error.bind(console));     </script> 

and replaced my

<script src="js/allmyconcatfilesintoone.js"></script> 

but got error, require missing/unknown.

how angular2 applications filled 1 file? have gather typescript files first , concat , compile via gulp?

regards

tenoda

use gulpfile.js this:

/// <binding clean='clean' />             "use strict";              var gulp = require("gulp"),                 rimraf = require("rimraf"),                 concat = require("gulp-concat"),                 cssmin = require("gulp-cssmin"),                 uglify = require("gulp-uglify"),                 tsc = require("gulp-typescript");              var webroot = "./wwwroot/";              var paths = {                 js: webroot + "js/**/*.js",                 ts: webroot + "app/**/*.ts",                 minjs: webroot + "js/**/*.min.js",                 css: webroot + "css/**/*.css",                 mincss: webroot + "css/**/*.min.css",                 concatjsdest: webroot + "js/site.min.js",                 concatcssdest: webroot + "css/site.min.css"             };              gulp.task("clean:js", function (cb) {                 rimraf(paths.concatjsdest, cb);             });              gulp.task("clean:css", function (cb) {                 rimraf(paths.concatcssdest, cb);             });              gulp.task("clean", ["clean:js", "clean:css"]);              gulp.task("min:js", function () {                 return gulp.src([paths.js, "!" + paths.minjs], { base: "." })                     .pipe(concat(paths.concatjsdest))                     .pipe(uglify())                     .pipe(gulp.dest("."));             });              gulp.task("min:css", function () {                 return gulp.src([paths.css, "!" + paths.mincss])                     .pipe(concat(paths.concatcssdest))                     .pipe(cssmin())                     .pipe(gulp.dest("."));             });              gulp.task("min", ["min:js", "min:css"]); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -