1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-07-07 12:25:46 +02:00

preprocess dist for self hosted

This commit is contained in:
Kyle Spearrin 2017-08-15 09:16:19 -04:00
parent 2772bffd09
commit 635caa9ad0
5 changed files with 18 additions and 7 deletions

View File

@ -6,7 +6,7 @@ echo "`nBuilding app"
echo "npm version $(npm --version)"
echo "gulp version $(gulp --version)"
npm install
gulp dist
gulp dist:selfHosted
echo "`nBuilding docker image"
docker --version

View File

@ -9,7 +9,7 @@ echo -e "\nBuilding app"
echo -e "npm version $(npm --version)"
echo -e "gulp version $(gulp --version)"
npm install
gulp dist
gulp dist:selfHosted
echo -e "\nBuilding docker image"
docker --version

View File

@ -74,6 +74,7 @@ gulp.task('min:js', ['clean:js'], function () {
'!' + paths.jsDir + 'duo.js',
'!' + paths.jsDir + 'settings.js'
], { base: '.' })
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
.pipe(concat(paths.concatJsDest))
.pipe(uglify())
.pipe(gulp.dest('.'));
@ -369,7 +370,7 @@ gulp.task('dist:css', function () {
paths.cssDir + '**/*.css',
'!' + paths.cssDir + '**/*.min.css'
])
.pipe(preprocess({ context: { cacheTag: randomString } }))
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
.pipe(cssmin())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(paths.dist + 'css'));
@ -385,7 +386,7 @@ gulp.task('dist:js:app', function () {
]);
merge(mainStream, config())
.pipe(preprocess({ context: { cacheTag: randomString } }))
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
.pipe(concat(paths.dist + '/js/app.min.js'))
.pipe(ngAnnotate())
.pipe(uglify())
@ -399,7 +400,7 @@ gulp.task('dist:js:fallback', function () {
]);
merge(mainStream)
.pipe(preprocess({ context: { cacheTag: randomString } }))
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(paths.dist + 'js'));
@ -437,7 +438,7 @@ gulp.task('dist:preprocess', function () {
.src([
paths.dist + '/**/*.html'
], { base: '.' })
.pipe(preprocess({ context: { cacheTag: randomString } }))
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
.pipe(gulp.dest('.'));
});
@ -449,6 +450,12 @@ gulp.task('dist', ['build'], function (cb) {
cb);
});
var selfHosted = false;
gulp.task('dist:selfHosted', function (cb) {
selfHosted = true;
return runSequence('dist', cb);
});
gulp.task('deploy', ['dist'], function () {
return gulp.src(paths.dist + '**/*')
.pipe(ghPages({ cacheDir: paths.dist + '.publish' }));

View File

@ -53,8 +53,10 @@
<title page-title>bitwarden.com Password Manager</title>
<!-- @if !selfHosted !>
<script src="https://js.stripe.com/v2/"></script>
<script src="https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js"></script>
<!-- @endif -->
<!-- @if true !>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

View File

@ -1,4 +1,5 @@
(function (i, s, o, g, r, a, m) {
// @if !selfHosted
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
@ -6,3 +7,4 @@
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-81915606-3', 'auto');
// @endif