Last active
May 28, 2018 17:25
-
-
Save adeonir/4d2f652f5a00b2124b4f640fe268a0c8 to your computer and use it in GitHub Desktop.
Revisions
-
adeonir revised this gist
May 28, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -92,9 +92,7 @@ gulp.task('deploy', () => { parallel: 10, }); return gulp.src('_site/**', { base: '_site/', buffer: false }) .pipe(conn.newer('/public_html')) .pipe(conn.dest('/public_html')); }); -
adeonir revised this gist
May 28, 2018 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,9 +86,9 @@ gulp.task('watch', () => { gulp.task('deploy', () => { const conn = ftp.create({ host: '', user: '', pass: '', parallel: 10, }); -
adeonir created this gist
May 28, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,104 @@ const gulp = require('gulp'); const yargs = require('yargs'); const plumber = require('gulp-plumber'); const sass = require('gulp-sass'); const postcss = require('gulp-postcss'); const autoprefixer = require('autoprefixer'); const cssnano = require('cssnano'); const svgmin = require('gulp-svgmin'); const rename = require('gulp-rename'); const babel = require('gulp-babel'); const minify = require('gulp-babel-minify'); const ftp = require('vinyl-ftp'); const browserSync = require('browser-sync'); const childProcess = require('child_process'); const deploy = Boolean(yargs.argv.production); gulp.task('jekyll', (done) => { if (deploy) { const production = process.env; production.JEKYLL_ENV = 'production'; return childProcess.spawn('jekyll', ['build'], { stdio: 'inherit', env: production }) .on('close', done); } return childProcess.spawn('jekyll', ['build'], { stdio: 'inherit' }) .on('close', done); }); gulp.task('rebuild', ['jekyll'], () => { browserSync.reload(); }); gulp.task('browser-sync', ['jekyll'], () => { browserSync({ server: { baseDir: '_site', }, }); }); gulp.task('styles', () => { gulp.src('src/sass/main.scss') .pipe(plumber()) .pipe(sass()) .pipe(postcss([autoprefixer(), cssnano()])) .pipe(gulp.dest('_site/assets/css/')) .pipe(browserSync.reload({ stream: true })) .pipe(gulp.dest('assets/css/')); }); gulp.task('scripts', () => { gulp.src('src/js/*.js') .pipe(plumber()) .pipe(babel()) .pipe(minify()) .pipe(gulp.dest('_site/assets/js/')) .pipe(browserSync.reload({ stream: true })) .pipe(gulp.dest('assets/js/')); }); gulp.task('images', () => { gulp.src('src/img/**/*') .pipe(gulp.dest('_site/assets/img/')) .pipe(browserSync.reload({ stream: true })) .pipe(gulp.dest('assets/img/')); }); gulp.task('vectors', () => { gulp.src('src/svg/**/*') .pipe(plumber()) .pipe(svgmin()) .pipe(rename({ extname: '.html', })) .pipe(gulp.dest('_includes/')) .pipe(browserSync.reload({ stream: true })); }); gulp.task('watch', () => { gulp.watch('src/sass/**/*', ['styles', 'rebuild']); gulp.watch('src/js/*.js', ['scripts', 'rebuild']); gulp.watch(['**/*.html', '_includes/*.html', '_layouts/*.html'], ['rebuild']); }); gulp.task('deploy', () => { const conn = ftp.create({ host: 'ftp.tralog.com.br', user: 'tralog1', pass: 'ford2018!', parallel: 10, }); const globs = ['./_site/**']; return gulp.src(globs, { base: '.', buffer: false }) .pipe(conn.newer('/public_html')) .pipe(conn.dest('/public_html')); }); gulp.task('dev', ['images', 'vectors', 'styles', 'scripts', 'browser-sync', 'watch']); gulp.task('build', ['images', 'vectors', 'styles', 'scripts', 'jekyll']);