Merge pull request #23 from rancher/dockerfile

updates dockerfile to rebuild when js/css change
This commit is contained in:
Westly Wright
2018-04-25 14:46:28 -07:00
committed by GitHub
2 changed files with 27 additions and 39 deletions
+20 -34
View File
@@ -32,16 +32,22 @@ gulp.task('dev', ['build-dev'], () => {
gulp.start('init-watch');
});
gulp.task('build', () => {
runSequence('pub-delete', ['sass', 'build:vendor', 'build:app', 'fonts', 'img'], 'hugo' /*, 'hugo-search-index'*/);
gulp.task('build', (cb) => {
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo' /*, 'hugo-search-index'*/, () => {
cb();
});
});
gulp.task('build-staging', () => {
runSequence('pub-delete', ['sass', 'build:vendor', 'build:app', 'fonts', 'img'], 'hugo-staging' /*, 'hugo-search-index'*/);
gulp.task('build-staging', (cb) => {
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo-staging' /*, 'hugo-search-index'*/, () => {
cb();
});
});
gulp.task('build-dev', () => {
runSequence('pub-delete', ['sass', 'build:vendor', 'build:app', 'fonts', 'img'], 'hugo-dev' /*, 'hugo-search-index'*/);
gulp.task('build-dev', (cb) => {
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo-dev' /*, 'hugo-search-index'*/, () => {
cb();
});
});
gulp.task('hugo', (cb) => {
@@ -73,11 +79,10 @@ gulp.task('init-watch', () => {
port: 9001,
open: false
});
$.watch('src/sass/**/*.scss', () => gulp.start('sass'));
$.watch('node_modules/rancher-website-theme/**/*.scss', () => gulp.start('sass'));
$.watch('src/js/**/*.js', () => gulp.start('js'));
$.watch('src/img/**/*', () => gulp.start('img'));
$.watch(['archetypes/**/*', 'data/**/*', 'content/**/*', 'layouts/**/*', 'static/**/*', 'themes/**/*', 'node_modules/rancher-website-theme/**/*', 'config.toml'], () => gulp.start('hugo-dev'));
gulp.watch([ 'src/sass/**/*.scss', 'node_modules/rancher-website-theme/**/*.scss' ], () => gulp.start('sass'));
gulp.watch('src/js/**/*.js', () => gulp.start('build:app'));
gulp.watch('src/img/**/*', () => gulp.start('img'));
gulp.watch(['archetypes/**/*', 'data/**/*', 'content/**/*', 'layouts/**/*', 'static/**/*.{js,css}', 'themes/**/*', 'node_modules/rancher-website-theme/**/*', 'config.toml'], () => gulp.start('hugo-dev'));
});
@@ -94,8 +99,7 @@ gulp.task('sass', () => {
.pipe($.autoprefixer(['ie >= 10', 'last 2 versions']))
.pipe($.if(isProduction, $.cssnano({ discardUnused: false, minifyFontValues: false })))
.pipe($.size({ gzip: true, showFiles: true }))
.pipe(gulp.dest('static/css'))
.pipe(browserSync.stream());
.pipe(gulp.dest('static/css'));
});
const vendors = ['ml-stack-nav', 'lory.js', 'tingle.js', 'moment', 'jquery'];
@@ -108,14 +112,14 @@ gulp.task('build:vendor', () => {
b.require(lib);
});
b.bundle()
return b.bundle()
.pipe(source('vendor.js'))
.pipe(buffer())
.pipe(gulp.dest('static/js'));
});
gulp.task('build:app', () => {
browserify({
return browserify({
entries: ['./src/js/app.js'],
extensions: ['.js',],
debug: true,
@@ -129,18 +133,6 @@ gulp.task('build:app', () => {
.pipe(gulp.dest('static/js'));
});
gulp.task('js', () => {
return gulp.src([
'src/js/**/*.js'
])
.pipe($.plumber({ errorHandler: onError }))
.pipe($.babel())
.pipe($.concat('app.js'))
.pipe($.if(isProduction, $.uglify()))
.pipe($.size({ gzip: true, showFiles: true }))
.pipe(gulp.dest('static/js'));
});
gulp.task('fonts', () => {
return gulp.src('src/fonts/**/*.{woff,woff2}')
.pipe(gulp.dest('static/fonts'));
@@ -163,11 +155,5 @@ gulp.task('cms-delete', () => {
});
gulp.task('pub-delete', (cb) => {
del(['public/**', '!public'], {
// dryRun: true,
dot: true
}).then(paths => {
console.log('Total Files Deleted: ' + paths.length + '\n');
cb();
});
return del(['public/**', '!public']);
});
+7 -5
View File
@@ -1,5 +1,5 @@
{{ .Scratch.Set "topLevel" . }}
{{ .Scratch.Set "secondLevel" . }}
{{ $.Scratch.Set "topLevel" . }}
{{ $.Scratch.Set "secondLevel" . }}
<nav>
<!-- tabs -->
@@ -10,9 +10,11 @@
<a href="{{ .URL }}" class="btn bg-link p-a-0">
<span class="p-h-xs">
{{ range .Site.Sections }}
{{ if .IsAncestor .CurrentSection }}
{{ .Scratch.Set "topLevel" . }}
{{ .Title }}
{{if $.CurrentSection}}
{{ if .IsAncestor $.CurrentSection }}
{{ $.Scratch.Set "topLevel" . }}
{{ .Title }}
{{end}}
{{end}}
{{end}}
</span>