when creating website, used link scripts individually , worked fine. learning use gulp , noticed after concatenate js files, scripts stop working (again, work when loaded individually).
the thing found on net might have concatenate files in order. tried changing order in gulpfile.js task no avail. tried removing files 1 one in gulpfile.js task no avail.
also, keep modernizr , jquery in header , loaded individually (they not concatenated others) while concatenated js file in footer, therefore loaded after.
html file looks :
<!doctype html> <html> <head> <meta ...> <link...> <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script src="https://code.jquery.com/jquery-migrate-3.0.0.min.js"></script> <script src="assets/scripts/modernizr.js"></script> <title>some title</title> </head> <body> website content <script src="assets/scripts/scripts.min.js"></script> /*concatenated file*/ </body> </html>
my gulp task (gulpfile.js) looks (i've separated scripts concatenate in array guys can see files) :
gulp.task('js', function(){ return gulp.src([ 'assets/scripts/base/bootstrap.js', 'assets/scripts/base/retina.js', 'assets/scripts/base/smoothscroll.js', 'assets/scripts/base/waypoints.js', 'assets/scripts/base/wow.js', 'assets/scripts/plugins/bootstrap.filestyle.js', 'assets/scripts/plugins/jquery.counterup.js', 'assets/scripts/plugins/jquery.matchheight.js', 'assets/scripts/plugins/lightcase.js', 'assets/scripts/plugins/slick.js', 'assets/scripts/plugins/global.js' ]) .pipe(plumber({ errorhandler: function (error) { console.log(error.message); this.emit('end'); }})) .pipe(concat('scripts.js')) .pipe(babel()) .pipe(gulp.dest('assets/scripts/')) .pipe(rename({suffix: '.min'})) .pipe(uglify()) .pipe(gulp.dest('assets/scripts/')) .pipe(browsersync.reload({stream:true})) });
for now, scripts noted stopped working lighcase.js (lightbox), jquery.matchheight.js (matching column height) , slick.js (slider).
edit : no errors on console. message "jqmigrate: migrate installed, version 3.0.0".
any appreciated. after 1 week of trying find logic behind issue, give lol. noob!
omg, work debug , global.js path wrong in gulpfile task...
'assets/scripts/plugins/global.js'
that supposed :
'assets/scripts/base/global.js'
man feel retard. anyways guys... :s
Comments
Post a Comment