Skip to content

Commit a991ef9

Browse files
committed
cache busting is no longer hash based, now timestamp
1 parent 7f4a94d commit a991ef9

File tree

6 files changed

+11
-31
lines changed

6 files changed

+11
-31
lines changed

app.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ app.use(cors());
6060
//---------------------
6161
// Cache Busting Hash
6262
//---------------------
63-
var bust_js = require('./busters_js.json');
64-
var bust_css = require('./busters_css.json');
65-
process.env.cachebust_js = bust_js['public/js/singlejshash']; //i'm just making 1 hash against all js for easier jade implementation
66-
process.env.cachebust_css = bust_css['public/css/singlecsshash']; //i'm just making 1 hash against all css for easier jade implementation
63+
process.env.cachebust_js = Date.now(); //i'm just making 1 hash against all js for easier jade implementation
64+
process.env.cachebust_css = Date.now(); //i'm just making 1 hash against all css for easier jade implementation
6765
logger.debug('cache busting hash js', process.env.cachebust_js, 'css', process.env.cachebust_css);
6866

6967
// ============================================================================================================================

busters_css.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

busters_js.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

gulpfile.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var sass = require('gulp-sass');
44
var concat = require('gulp-concat');
55
var cleanCSS = require('gulp-clean-css');
66
var rename = require('gulp-rename');
7-
var bust = require('gulp-buster');
87
var spawn = require('child_process').spawn;
98
var node, env = process.env;
109

@@ -18,34 +17,19 @@ gulp.task('build-sass', function () {
1817
.pipe(cleanCSS()) //minify
1918
.pipe(rename('main.min.css'))
2019
.pipe(gulp.dest(path.join(__dirname,'/public/css'))) //dump it here
21-
.pipe(rename('singlecsshash'))
22-
.pipe(bust({fileName: 'busters_css.json'})) //cache bust
2320
.pipe(gulp.dest('.')); //dump busters_css.json
2421
});
2522

26-
gulp.task('build-js-hash', function () {
27-
gulp.src(path.join(__dirname,'/public/js/*.js'))
28-
.pipe(concat('singlejshash')) //concat them all
29-
.pipe(bust({fileName: 'busters_js.json'})) //cache bust
30-
.pipe(gulp.dest('.')); //dump busters_js.json
31-
});
32-
33-
3423
// ---------------- Run Application Task ---------------- //
3524
gulp.task('server', function(a, b) {
3625
if(node) node.kill();
3726
node = spawn('node', ['app.js'], {env: env, stdio: 'inherit'}); //command, file, options
3827
});
3928

40-
// ---------------- Watch for Changes Tasks ---------------- //
29+
// ---------------- Watch for Change Tasks ---------------- //
4130
gulp.task('watch-sass', ['build-sass'], function () {
4231
gulp.watch(path.join(__dirname, '/scss/*.scss'), ['build-sass']);
4332
});
44-
45-
gulp.task('watch-js', ['build-js-hash'], function () {
46-
gulp.watch(path.join(__dirname,'/public/js/*.js'), ['build-js-hash']);
47-
});
48-
4933
gulp.task('watch-server', function () {
5034
gulp.watch(path.join(__dirname, '/routes/**/*.js'), ['server']);
5135
gulp.watch([path.join(__dirname, '/utils/fc_wrangler/*.js')], ['server']);
@@ -54,19 +38,19 @@ gulp.task('watch-server', function () {
5438
});
5539

5640

57-
// ---------------- Gulp Tasks ---------------- //
58-
gulp.task('default', ['watch-sass', 'watch-js', 'watch-server', 'server']); //run with command `gulp`
59-
gulp.task('marbles1', ['start_marbles1', 'watch-sass', 'watch-js', 'watch-server', 'server']); //run with command `gulp marbles` [THIS ONE!]
60-
gulp.task('marbles2', ['start_marbles2', 'watch-sass', 'watch-js', 'watch-server', 'server']); //run with command `gulp marbles` [THIS ONE!]
41+
// ---------------- Runable Gulp Tasks ---------------- //
42+
gulp.task('default', ['watch-sass', 'watch-server', 'server']);
43+
gulp.task('marbles1', ['start_marbles1', 'watch-sass', 'watch-server', 'server']); //run with command `gulp marbles` [THIS ONE!]
44+
gulp.task('marbles2', ['start_marbles2', 'watch-sass', 'watch-server', 'server']); //run with command `gulp marbles`
6145

6246

63-
//marbles 2
47+
// launch marbles 1
6448
gulp.task('start_marbles1', function () {
6549
env['creds_filename'] = 'marbles1.json';
6650
console.log('\n[International Marbles Trading Consortium] 1\n');
6751
});
6852

69-
//marbles 1
53+
// launch marbles 2
7054
gulp.task('start_marbles2', function () {
7155
env['creds_filename'] = 'marbles2.json';
7256
console.log('\n[International Marbles Trading Consortium] 2\n');

0 commit comments

Comments
 (0)