I'm not sure if I'm understanding Browserify correctly, but am I able to essentially require()
this smooth-scroll plugin (installed via npm) in my app.js
file and Browserify will bundle it all together in my final app.js
file?
app.js
var ss = require('./smooth-scroll');
$(document).ready(function(){
ss.init();
});
gulpfile.js
gulp.task('js', function () {
var browserified = transform(function(filename) {
var b = browserify(filename);
return b.bundle();
});
return gulp.src('./src/js/app.js')
.pipe(browserified)
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./_site/public/js'))
});
Aucun commentaire:
Enregistrer un commentaire