javascript - gulp main.js does not include all js files -


i'm trying add build tool-gulp angularjs project think i'm doing wrong config b/c keep getting errors like

  • require not defined
  • angular not defined
  • or app not defined (var app = angular.module("app",[]); )

i have multiple js files 1 service/factories, controllers, , modules. want build scripts when main.js has modules defined not have other js files. not sure if suppose copy html files dist folder. have tried both ways keep getting errors service undefined or app undefined, etc. know doing wrong.

this code resides in gulp.js:

var gulp=require('gulp');  var connect = require('gulp-connect'); var browserify=require('browserify'); var source=require('vinyl-source-stream'); var jshint=require("gulp-jshint"); var concat=require('gulp-concat'); var del = require('del');  gulp.task('browserify', function(){     return browserify('./app/app.js').bundle().pipe(source("main.js")).pipe(gulp.dest("./dist/js")); });  gulp.task('watch', ['scripts'], function(){     gulp.watch('app/**/*.js',['scripts']);  });  gulp.task("scripts", function(){     return gulp.src("app/**/*.js").pipe(concat('main.js')).pipe(gulp.dest("./dist/js")); });  gulp.task("html",function(){     return gulp.src('app/**/*.html').pipe(gulp.dest('./dist/html')); });  gulp.task('clean',function(done){     del(['./dist'],done); });  gulp.task('connect', function(){     connect.server({         root: "./",         port: 4000     }); });  gulp.task('build', ['clean','scripts','html','connect',"watch"]); 

in index.html file:

... scripts (like jquery, foundation, etc.) <script type="text/javascript" src="./dist/js/main.js"></script> 

i have been following these tutorials:

https://omarfouad.com/  http://paislee.io/a-healthy-gulp-setup-for-angularjs-projects/ https://johnpapa.net/angular-and-gulp/ http://blog.angular-university.io/what-every-angular-project-likely-needs-and-a-gulp-build-to-provide-it/ 


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -