1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

cache tag for local assets on preprocess build

This commit is contained in:
Kyle Spearrin 2016-10-13 19:57:56 -04:00
parent 6569fbe6aa
commit 3375bda789
3 changed files with 13 additions and 13 deletions

View File

@ -30,6 +30,8 @@ paths.lessDir = 'less/';
paths.cssDir = paths.webroot + 'css/'; paths.cssDir = paths.webroot + 'css/';
paths.jsDir = paths.webroot + 'js/'; paths.jsDir = paths.webroot + 'js/';
var randomString = Math.random().toString(36).substring(7);
gulp.task('lint', function () { gulp.task('lint', function () {
return gulp.src(paths.webroot + 'app/**/*.js') return gulp.src(paths.webroot + 'app/**/*.js')
.pipe(jshint()) .pipe(jshint())
@ -261,7 +263,7 @@ gulp.task('dist:css', function () {
paths.cssDir + '**/*.css', paths.cssDir + '**/*.css',
'!' + paths.cssDir + '**/*.min.css' '!' + paths.cssDir + '**/*.min.css'
]) ])
.pipe(preprocess({ context: settings })) .pipe(preprocess({ context: { cacheTag: randomString } }))
.pipe(cssmin()) .pipe(cssmin())
.pipe(rename({ suffix: '.min' })) .pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(paths.dist + 'css')); .pipe(gulp.dest(paths.dist + 'css'));
@ -277,7 +279,7 @@ gulp.task('dist:js:app', function () {
]); ]);
merge(mainStream, config()) merge(mainStream, config())
.pipe(preprocess({ context: settings })) .pipe(preprocess({ context: { cacheTag: randomString } }))
.pipe(concat(paths.dist + '/js/app.min.js')) .pipe(concat(paths.dist + '/js/app.min.js'))
.pipe(ngAnnotate()) .pipe(ngAnnotate())
.pipe(uglify()) .pipe(uglify())
@ -306,7 +308,7 @@ gulp.task('dist:preprocess', function () {
.src([ .src([
paths.dist + '/**/*.html' paths.dist + '/**/*.html'
], { base: '.' }) ], { base: '.' })
.pipe(preprocess({ context: settings })) .pipe(preprocess({ context: { cacheTag: randomString }}))
.pipe(gulp.dest('.')); .pipe(gulp.dest('.'));
}); });

View File

@ -58,7 +58,6 @@
/// <reference path="lib/angular-resource/angular-resource.js" /> /// <reference path="lib/angular-resource/angular-resource.js" />
/// <reference path="lib/angulartics/angulartics.js" /> /// <reference path="lib/angulartics/angulartics.js" />
/// <reference path="lib/angulartics/angulartics-ga.js" /> /// <reference path="lib/angulartics/angulartics-ga.js" />
/// <reference path="lib/angular-toastr/angular-toastr.js" />
/// <reference path="lib/angular-toastr/angular-toastr.min.js" /> /// <reference path="lib/angular-toastr/angular-toastr.min.js" />
/// <reference path="lib/angular-toastr/angular-toastr.tpls.js" /> /// <reference path="lib/angular-toastr/angular-toastr.tpls.js" />
/// <reference path="lib/angular-ui-router/angular-ui-router.js" /> /// <reference path="lib/angular-ui-router/angular-ui-router.js" />
@ -70,4 +69,3 @@
/// <reference path="lib/papaparse/papaparse.js" /> /// <reference path="lib/papaparse/papaparse.js" />
/// <reference path="lib/sjcl/bitArray.js" /> /// <reference path="lib/sjcl/bitArray.js" />
/// <reference path="lib/sjcl/cbc.js" /> /// <reference path="lib/sjcl/cbc.js" />
/// <reference path="lib/sjcl/sjcl.js" />

View File

@ -10,13 +10,13 @@
<!-- @if true !> <!-- @if true !>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<meta name="x-stylesheet-test-bs" content="" class="invisible" /> <meta name="x-stylesheet-test-bs" content="" class="invisible" />
<script>!function(a,b,c){var d,e=document,f=e.getElementsByTagName('SCRIPT'),g=f[f.length-1].previousElementSibling,h=e.defaultView&&e.defaultView.getComputedStyle?e.defaultView.getComputedStyle(g):g.currentStyle;if(h&&h[a]!==b)for(d=0;d<c.length;d++)e.write('<link rel="stylesheet" href="'+c[d]+'"/>')}('visibility','hidden',['lib\/bootstrap\/css\/bootstrap.min.css']);</script> <script>!function(a,b,c){var d,e=document,f=e.getElementsByTagName('SCRIPT'),g=f[f.length-1].previousElementSibling,h=e.defaultView&&e.defaultView.getComputedStyle?e.defaultView.getComputedStyle(g):g.currentStyle;if(h&&h[a]!==b)for(d=0;d<c.length;d++)e.write('<link rel="stylesheet" href="'+c[d]+'"/>')}('visibility','hidden',['lib\/bootstrap\/css\/bootstrap.min.css?v=<!-- @echo cacheTag !>']);</script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" />
<meta name="x-stylesheet-test-fa" content="" class="fa" /> <meta name="x-stylesheet-test-fa" content="" class="fa" />
<script>!function(a,b,c){var d,e=document,f=e.getElementsByTagName('SCRIPT'),g=f[f.length-1].previousElementSibling,h=e.defaultView&&e.defaultView.getComputedStyle?e.defaultView.getComputedStyle(g):g.currentStyle;if(h&&h[a]!==b)for(d=0;d<c.length;d++)e.write('<link rel="stylesheet" href="'+c[d]+'"/>')}('font-family','FontAwesome',['lib\/font-awesome\/css\/font-awesome.min.css']);</script> <script>!function(a,b,c){var d,e=document,f=e.getElementsByTagName('SCRIPT'),g=f[f.length-1].previousElementSibling,h=e.defaultView&&e.defaultView.getComputedStyle?e.defaultView.getComputedStyle(g):g.currentStyle;if(h&&h[a]!==b)for(d=0;d<c.length;d++)e.write('<link rel="stylesheet" href="'+c[d]+'"/>')}('font-family','FontAwesome',['lib\/font-awesome\/css\/font-awesome.min.css?v=<!-- @echo cacheTag !>']);</script>
<link rel="stylesheet" href="css/vault.min.css" /> <link rel="stylesheet" href="css/vault.min.css?v=<!-- @echo cacheTag !>" />
<!-- @endif --> <!-- @endif -->
<!-- @exclude --> <!-- @exclude -->
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css" /> <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css" />
@ -30,16 +30,16 @@
<!-- @if true !> <!-- @if true !>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script>(window.jQuery||document.write('<script src="lib\/jquery\/jquery.min.js"><\/script>'));</script> <script>(window.jQuery||document.write('<script src="lib\/jquery\/jquery.min.js?v=<!-- @echo cacheTag !>"><\/script>'));</script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>((window.jQuery&&window.jQuery.fn&&window.jQuery.fn.modal)||document.write('<script src="lib\/bootstrap\/js\/bootstrap.min.js"><\/script>'));</script> <script>((window.jQuery&&window.jQuery.fn&&window.jQuery.fn.modal)||document.write('<script src="lib\/bootstrap\/js\/bootstrap.min.js?v=<!-- @echo cacheTag !>"><\/script>'));</script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script>(window.angular||document.write('<script src="lib\/angular\/angular.min.js"><\/script>'));</script> <script>(window.angular||document.write('<script src="lib\/angular\/angular.min.js?v=<!-- @echo cacheTag !>"><\/script>'));</script>
<script src="js/lib.min.js"></script> <script src="js/lib.min.js?v=<!-- @echo cacheTag !>"></script>
<script src="js/app.min.js"></script> <script src="js/app.min.js?v=<!-- @echo cacheTag !>"></script>
<script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){