3

I am using gulp for the first time and obviously got 2 problems as follows

First here goes my gulp file, it is very basic nothing fancy yet.

var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');

gulp.task('scripts', function() {
    return gulp.src('js/*.js')
        .pipe(concat('all.js'))
        .pipe(gulp.dest('dist'))
        .pipe(rename('all.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest('dist'));
});

gulp.task('controllers', function() {
    return gulp.src('controllers/*.js')
        .pipe(concat(EVER_FILE))
        .pipe(gulp.dest('dist'))
        .pipe(rename(EVER_FILE))
        .pipe(uglify())
        .pipe(gulp.dest('dist'));
});
gulp.task('default', ['scripts','controllers']);

Question 1: How do i get the controllers task to concat and minify each file on its own?

Question 2: How do i create a task that can add a random number in the index.html Javascript files as in <script src='js/controller.js?RandomNumber'></script>

Mariano Desanze
  • 7,847
  • 7
  • 46
  • 67
user3052526
  • 681
  • 10
  • 24
  • 2nd question might be a duplicate of http://stackoverflow.com/questions/28573508/gulp-automatically-add-version-number-to-request-for-preventing-browser-cache – Mariano Desanze Sep 30 '16 at 22:58

0 Answers0