Skip to content

Commit

Permalink
fix(build.frontend): use cache-bust with location path
Browse files Browse the repository at this point in the history
  • Loading branch information
davinkevin committed Oct 30, 2015
1 parent 07788ef commit 606e91a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 13 additions & 7 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import proxy from 'proxy-middleware';
import urlparser from 'url';
import cachebust from 'gulp-cache-bust';
import bower from 'gulp-bower';
import runSequence from 'run-sequence';

let args = yargs.argv;
let env = args.env || 'prod';
Expand Down Expand Up @@ -55,6 +56,8 @@ let redirect = (route) => {
}
};

let min = (env === 'dev') ? '' : '.min';

// Lint Task
gulp.task('lint', () =>
gulp.src(angularAppLocation)
Expand Down Expand Up @@ -95,19 +98,22 @@ gulp.task('less', () =>

gulp.task('bower-install', () => bower() );

gulp.task('inject', ['bower-install'], () => {

var min = (env === 'dev') ? '' : '.min';
gulp.task('inject:files', () =>
gulp.src(bowerFiles({checkExistence : true, read: true, debugging : false, env : env}), {base: 'bower_components'})
.pipe(gulp.dest(appLocation + 'lib/'))
);

gulp.task('inject:index', () =>
gulp.src(indexLocation)
.pipe(inject(gulp.src(bowerFiles({read: false, debugging : false, env : env})), { addRootSlash : false, ignorePath : "/bower_components/", addPrefix : "app/lib"}))
.pipe(inject(gulp.src(appFiles).pipe(rename({suffix : min})), {addRootSlash : false, ignorePath : staticLocation , name: 'app'}))
.pipe(cachebust({ type : 'MD5'}))
.pipe(cachebust({ type : 'MD5', basePath : staticLocation}))
.pipe(gulp.dest(staticLocation))
.pipe(connect.reload());
.pipe(connect.reload())
);

gulp.src(bowerFiles({checkExistence : true, read: true, debugging : false, env : env}), {base: 'bower_components'})
.pipe(gulp.dest(appLocation + 'lib/'));
gulp.task('inject', ['bower-install'], (cb) => {
return runSequence('inject:files', 'inject:index', cb);
});

gulp.task('web-server', () => {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"devDependencies": {
"gulp-connect": "^2.2.0",
"gulp-jshint": "^1.10.0",
"proxy-middleware": "^0.11.0"
"proxy-middleware": "^0.11.0",
"run-sequence": "^1.1.4"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 606e91a

Please sign in to comment.