From 6feb12bf4485224d622b14bc37a4f3bdac0d938a Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Wed, 25 Apr 2018 14:45:04 -0700 Subject: [PATCH] docker file change and bug fixes rancherlabs/website-theme#7 --- Dockerfile.dev | 1 - gulpfile.babel.js | 42 ++++++++++++++++------------------ layouts/partials/docs-nav.html | 12 ++++++---- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 85930bb6660..3069dfa4a3a 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -12,7 +12,6 @@ RUN ln -s /site/config.toml /run \ && ln -s /site/data /run \ && ln -s /site/layouts /run \ && ln -s /site/src /run \ - && ln -s /site/static /run \ && ln -s /site/themes /run \ && ln -s /site/scripts /run diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 2bd0584628b..d5a721c4503 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -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('build:app')); - $.watch('src/img/**/*', () => gulp.start('img')); - $.watch(['archetypes/**/*', 'data/**/*', 'content/**/*', 'layouts/**/*', 'static/**/*.{js,css}', '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, @@ -151,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']); }); diff --git a/layouts/partials/docs-nav.html b/layouts/partials/docs-nav.html index ebfdfc653be..1a1bb8e75ae 100644 --- a/layouts/partials/docs-nav.html +++ b/layouts/partials/docs-nav.html @@ -1,5 +1,5 @@ -{{ .Scratch.Set "topLevel" . }} -{{ .Scratch.Set "secondLevel" . }} +{{ $.Scratch.Set "topLevel" . }} +{{ $.Scratch.Set "secondLevel" . }}