Skip to content

Instantly share code, notes, and snippets.

@ThatRendle
Created June 25, 2015 15:59
Show Gist options
  • Save ThatRendle/a896ce8bd4522972329d to your computer and use it in GitHub Desktop.
Save ThatRendle/a896ce8bd4522972329d to your computer and use it in GitHub Desktop.
Gulp to copy js plus minified version
var gulp = require('gulp'),
hint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename');
gulp.task('lint', function() {
return gulp.src(['Scripts/**/*.js'])
.pipe(hint());
});
gulp.task('build-js', ['lint'], function() {
return gulp.src(['Scripts/**/*.js'])
.pipe(gulp.dest('wwwroot/js'))
.pipe(uglify())
.pipe(rename(function(path) {
path.basename += '.min';
})
.pipe(gulp.dest('wwwroot/js'));
});
gulp.task('default', ['build-js']);
@englishextra
Copy link

you missed closing bracket

var gulp = require('gulp'),
    hint = require('gulp-jshint'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename');

gulp.task('lint', function() {
    return gulp.src(['Scripts/**/*.js'])
        .pipe(hint());
});

gulp.task('build-js', ['lint'], function() {
    return gulp.src(['Scripts/**/*.js'])
        .pipe(gulp.dest('wwwroot/js'))
        .pipe(uglify())
        .pipe(rename(function(path) {
            path.basename += '.min';
        }))
        .pipe(gulp.dest('wwwroot/js'));
});

gulp.task('default', ['build-js']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment