preprocess dist for self hosted
This commit is contained in:
parent
2772bffd09
commit
635caa9ad0
|
@ -6,7 +6,7 @@ echo "`nBuilding app"
|
||||||
echo "npm version $(npm --version)"
|
echo "npm version $(npm --version)"
|
||||||
echo "gulp version $(gulp --version)"
|
echo "gulp version $(gulp --version)"
|
||||||
npm install
|
npm install
|
||||||
gulp dist
|
gulp dist:selfHosted
|
||||||
|
|
||||||
echo "`nBuilding docker image"
|
echo "`nBuilding docker image"
|
||||||
docker --version
|
docker --version
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -9,7 +9,7 @@ echo -e "\nBuilding app"
|
||||||
echo -e "npm version $(npm --version)"
|
echo -e "npm version $(npm --version)"
|
||||||
echo -e "gulp version $(gulp --version)"
|
echo -e "gulp version $(gulp --version)"
|
||||||
npm install
|
npm install
|
||||||
gulp dist
|
gulp dist:selfHosted
|
||||||
|
|
||||||
echo -e "\nBuilding docker image"
|
echo -e "\nBuilding docker image"
|
||||||
docker --version
|
docker --version
|
||||||
|
|
15
gulpfile.js
15
gulpfile.js
|
@ -74,6 +74,7 @@ gulp.task('min:js', ['clean:js'], function () {
|
||||||
'!' + paths.jsDir + 'duo.js',
|
'!' + paths.jsDir + 'duo.js',
|
||||||
'!' + paths.jsDir + 'settings.js'
|
'!' + paths.jsDir + 'settings.js'
|
||||||
], { base: '.' })
|
], { base: '.' })
|
||||||
|
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||||
.pipe(concat(paths.concatJsDest))
|
.pipe(concat(paths.concatJsDest))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
|
@ -369,7 +370,7 @@ gulp.task('dist:css', function () {
|
||||||
paths.cssDir + '**/*.css',
|
paths.cssDir + '**/*.css',
|
||||||
'!' + paths.cssDir + '**/*.min.css'
|
'!' + paths.cssDir + '**/*.min.css'
|
||||||
])
|
])
|
||||||
.pipe(preprocess({ context: { cacheTag: randomString } }))
|
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||||
.pipe(cssmin())
|
.pipe(cssmin())
|
||||||
.pipe(rename({ suffix: '.min' }))
|
.pipe(rename({ suffix: '.min' }))
|
||||||
.pipe(gulp.dest(paths.dist + 'css'));
|
.pipe(gulp.dest(paths.dist + 'css'));
|
||||||
|
@ -385,7 +386,7 @@ gulp.task('dist:js:app', function () {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
merge(mainStream, config())
|
merge(mainStream, config())
|
||||||
.pipe(preprocess({ context: { cacheTag: randomString } }))
|
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||||
.pipe(concat(paths.dist + '/js/app.min.js'))
|
.pipe(concat(paths.dist + '/js/app.min.js'))
|
||||||
.pipe(ngAnnotate())
|
.pipe(ngAnnotate())
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
|
@ -399,7 +400,7 @@ gulp.task('dist:js:fallback', function () {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
merge(mainStream)
|
merge(mainStream)
|
||||||
.pipe(preprocess({ context: { cacheTag: randomString } }))
|
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(rename({ suffix: '.min' }))
|
.pipe(rename({ suffix: '.min' }))
|
||||||
.pipe(gulp.dest(paths.dist + 'js'));
|
.pipe(gulp.dest(paths.dist + 'js'));
|
||||||
|
@ -437,7 +438,7 @@ gulp.task('dist:preprocess', function () {
|
||||||
.src([
|
.src([
|
||||||
paths.dist + '/**/*.html'
|
paths.dist + '/**/*.html'
|
||||||
], { base: '.' })
|
], { base: '.' })
|
||||||
.pipe(preprocess({ context: { cacheTag: randomString } }))
|
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -449,6 +450,12 @@ gulp.task('dist', ['build'], function (cb) {
|
||||||
cb);
|
cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var selfHosted = false;
|
||||||
|
gulp.task('dist:selfHosted', function (cb) {
|
||||||
|
selfHosted = true;
|
||||||
|
return runSequence('dist', cb);
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('deploy', ['dist'], function () {
|
gulp.task('deploy', ['dist'], function () {
|
||||||
return gulp.src(paths.dist + '**/*')
|
return gulp.src(paths.dist + '**/*')
|
||||||
.pipe(ghPages({ cacheDir: paths.dist + '.publish' }));
|
.pipe(ghPages({ cacheDir: paths.dist + '.publish' }));
|
||||||
|
|
|
@ -53,8 +53,10 @@
|
||||||
|
|
||||||
<title page-title>bitwarden.com Password Manager</title>
|
<title page-title>bitwarden.com Password Manager</title>
|
||||||
|
|
||||||
|
<!-- @if !selfHosted !>
|
||||||
<script src="https://js.stripe.com/v2/"></script>
|
<script src="https://js.stripe.com/v2/"></script>
|
||||||
<script src="https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js"></script>
|
<script src="https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js"></script>
|
||||||
|
<!-- @endif -->
|
||||||
<!-- @if true !>
|
<!-- @if true !>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||||
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
|
|
@ -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['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||||
(i[r].q = i[r].q || []).push(arguments)
|
(i[r].q = i[r].q || []).push(arguments)
|
||||||
}, i[r].l = 1 * new Date(); a = s.createElement(o),
|
}, 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');
|
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
|
||||||
|
|
||||||
ga('create', 'UA-81915606-3', 'auto');
|
ga('create', 'UA-81915606-3', 'auto');
|
||||||
|
// @endif
|
||||||
|
|
Loading…
Reference in New Issue