im new using gulp. i'm trying concatenate javascript files single file. currently, have following:
gulpfile.js
var gulp = require('gulp'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var input = { js: './src/**/*.js' }; var output = { js: './dist/myjavascript.min.js' } gulp.task('default', ['clean', 'bundle-js']); gulp.task('clean', function(callback) { }); gulp.task('bundle-js', function() { gulp.src(input.js) .pipe(concat(output.js)) .pipe(uglify()) ; }); when run this, myjavascript.min.js never gets generated. ran gulp --verbose , not see files being input. however, directory structure looks this:
/ /src /childdirectory file2.js file1.js gulpfile.js package.json based on understanding, expression used input.js should file1.js , file2.js. doing wrong?
you should give
file name inside concat function, should not give path name
add return before including source.
add destination
try following code,
gulp.task('bundle-js', function() { return gulp.src(input.js) .pipe(concat('myjavascript.min.js')) .pipe(uglify()) .pipe(gulp.dest('./dist/')); });
Comments
Post a Comment