gulpfile.js
function buildJs() {
	// Construct a stream for the JS sources of our plugin, don't read file contents when compiling TypeScript.
	var sourceStream = gulp.src( config.Sources.Scripts, {
		cwd  : config.WorkingDirectory,
		read : true
	} );

	return sourceStream
		.pipe( jscs() )
		.pipe( jscs.reporter() )
		.pipe( jsValidate() )
		.pipe( order() )
		// Only pass through files that have changed since the last build iteration (relevant during "watch").
		.pipe( cached( path.join( config.Output.Production, config.Output.DirectoryNames.Scripts ) ) )
		// Generate sourcemaps
		.pipe( sourcemaps.init() )
		.pipe( wrapper( {
			header : "(function() {\n\"use strict\";\n",
			footer : "}());"
		} ) )
		.pipe( jsValidate() )
		.pipe( jshint() )
		.pipe( jshint.reporter( stylish ) )
		// Put Angular dependency injection annotation where needed.
		.pipe( ngAnnotate() )
		// Pull out files which haven't changed since our last build iteration and put them back into the stream.
		.pipe( remember() )
		// Place the results in the development output directory.
		.pipe( gulp.dest( path.join( config.Output.Development, config.Output.DirectoryNames.Scripts ) ) )
		// Concatenate all files into a single one.
		.pipe( concat( slug( application.name ) + ".concat.js", {
			newLine : ";"
		} ) )
		// Put that file into the development output as well.
		.pipe( gulp.dest( path.join( config.Output.Development, config.Output.DirectoryNames.Scripts ) ) )
		// Minify the file.
		.pipe( uglify() )
		// Rename it to indicate minification.
		.pipe( rename( {
			extname : ".min.js"
		} ) )
		// Write out sourcemaps
		.pipe( sourcemaps.write( "maps" ) )
		// Write the file to the production output directory.
		.pipe( gulp.dest( path.join( config.Output.Production, config.Output.DirectoryNames.Scripts ) ) );
}
function buildJs() {
	// Construct a stream for the JS sources of our plugin, don't read file contents when compiling TypeScript.
	var sourceStream = gulp.src( config.Sources.Scripts, {
		cwd  : config.WorkingDirectory,
		read : true
	} );

	return sourceStream
		.pipe( jscs() )
		.pipe( jscs.reporter() )
		.pipe( jsValidate() )
		.pipe( order() )
		// Only pass through files that have changed since the last build iteration (relevant during "watch").
		.pipe( cached( path.join( config.Output.Production, config.Output.DirectoryNames.Scripts ) ) )
		// Generate sourcemaps
		.pipe( sourcemaps.init() )
		.pipe( wrapper( {
			header : "(function() {\n\"use strict\";\n",
			footer : "}());"
		} ) )
		.pipe( jsValidate() )
		.pipe( jshint() )
		.pipe( jshint.reporter( stylish ) )
		// Put Angular dependency injection annotation where needed.
		.pipe( ngAnnotate() )
		// Pull out files which haven't changed since our last build iteration and put them back into the stream.
		.pipe( remember() )
		// Place the results in the development output directory.
		.pipe( gulp.dest( path.join( config.Output.Development, config.Output.DirectoryNames.Scripts ) ) )
		// Concatenate all files into a single one.
		.pipe( concat( slug( application.name ) + ".concat.js", {
			newLine : ";"
		} ) )
		// Put that file into the development output as well.
		.pipe( gulp.dest( path.join( config.Output.Development, config.Output.DirectoryNames.Scripts ) ) )
		// Minify the file.
		.pipe( uglify() )
		// Rename it to indicate minification.
		.pipe( rename( {
			extname : ".min.js"
		} ) )
		// Write out sourcemaps
		.pipe( sourcemaps.write( "maps" ) )
		// Write the file to the production output directory.
		.pipe( gulp.dest( path.join( config.Output.Production, config.Output.DirectoryNames.Scripts ) ) );
}
function buildJs ( ) { // Construct a stream for the JS sources of our plugin, don't read file contents when compiling TypeScript. var sourceStream = gulp . src ( config . Sources . Scripts , { cwd : config . WorkingDirectory , read : true } ) ; return sourceStream . pipe ( jscs ( ) ) . pipe ( jscs . reporter ( ) ) . pipe ( jsValidate ( ) ) . pipe ( order ( ) ) // Only pass through files that have changed since the last build iteration (relevant during "watch"). . pipe ( cached ( path . join ( config . Output . Production , config . Output . DirectoryNames . Scripts ) ) ) // Generate sourcemaps . pipe ( sourcemaps . init ( ) ) . pipe ( wrapper ( { header : "(function() {\n\"use strict\";\n" , footer : "}());" } ) ) . pipe ( jsValidate ( ) ) . pipe ( jshint ( ) ) . pipe ( jshint . reporter ( stylish ) ) // Put Angular dependency injection annotation where needed. . pipe ( ngAnnotate ( ) ) // Pull out files which haven't changed since our last build iteration and put them back into the stream. . pipe ( remember ( ) ) // Place the results in the development output directory. . pipe ( gulp . dest ( path . join ( config . Output . Development , config . Output . DirectoryNames . Scripts ) ) ) // Concatenate all files into a single one. . pipe ( concat ( slug ( application . name ) + ".concat.js" , { newLine : ";" } ) ) // Put that file into the development output as well. . pipe ( gulp . dest ( path . join ( config . Output . Development , config . Output . DirectoryNames . Scripts ) ) ) // Minify the file. . pipe ( uglify ( ) ) // Rename it to indicate minification. . pipe ( rename ( { extname : ".min.js" } ) ) // Write out sourcemaps . pipe ( sourcemaps . write ( "maps" ) ) // Write the file to the production output directory. . pipe ( gulp . dest ( path . join ( config . Output . Production , config . Output . DirectoryNames . Scripts ) ) ) ; }
Core JS resource builder.
Core JS resource builder .