V
V
Vladmoshkov2019-11-08 12:23:33
rsync
Vladmoshkov, 2019-11-08 12:23:33

When you run the gulp rsync command, the deployment to the site does not start, how to fix it?

It starts, then, as I understand it, it doesn’t find something and finishes

Using gulpfile /mnt/c/Users/vladich/Desktop/technolife/gulpfile.js
[11:23:02] Starting 'rsync'...
[11:23:02] Finished 'rsync' after 33 ms

var syntax        = 'sass', // Syntax: sass or scss;
    gulpversion   = '4'; // Gulp version: 3 or 4 (см. readme.txt)

var gulp          = require('gulp'),
    gutil         = require('gulp-util' ),
    sass          = require('gulp-sass'),
    browserSync   = require('browser-sync'),
    concat        = require('gulp-concat'),
    uglify        = require('gulp-uglify'),
    cleancss      = require('gulp-clean-css'),
    rename        = require('gulp-rename'),
    autoprefixer  = require('gulp-autoprefixer'),
    notify        = require("gulp-notify"),
    rsync         = require('gulp-rsync');

gulp.task('browser-sync', function() {
  browserSync({
    server: {
      baseDir: '_site'
    },
    notify: false,
    // open: false,
    // tunnel: true,
    // tunnel: "projectname", //Demonstration page: http://projectname.localtunnel.me
  })
});

gulp.task('styles', function() {
  return gulp.src(syntax+'/**/*.'+syntax+'')
  .pipe(sass({ outputStyle: 'expand' }).on("error", notify.onError()))
  .pipe(rename({ suffix: '.min', prefix : '' }))
  .pipe(autoprefixer(['last 15 versions']))
  .pipe(cleancss( {level: { 1: { specialComments: 0 } } })) // Opt., comment out when debugging
  .pipe(gulp.dest('css'))
  .pipe(gulp.dest('_site/css'))
  .pipe(browserSync.reload( {stream: true} ))
});

gulp.task('scripts', function() {
  return gulp.src([
    'libs/jquery/dist/jquery.min.js',
    'libs/likely/likely.js',
    'libs/prognroll/prognroll.js',
    'js/common.js', // Always at the end
    ])
  .pipe(concat('scripts.min.js'))
  .pipe(uglify()) // Mifify js (opt.)
  .pipe(gulp.dest('js'))
  .pipe(gulp.dest('_site/js'))
  .pipe(browserSync.reload({ stream: true }))
});

gulp.task('code', function() {
  return gulp.src(['*.html', '_site/**/*.html'])
  .pipe(browserSync.reload({ stream: true }))
});

gulp.task('rsync', function() {
  return gulp.src('site/**')
  .pipe(rsync({
    root: 'site/',
    hostname: '[email protected]',
    destination: '/home/v/technolife/public_html/',
    include: ['*.htaccess'], // Includes files to deploy
    exclude: ['**/Thumbs.db', '**/*.DS_Store'], // Excludes files from deploy
    recursive: true,
    archive: true,
    silent: false,
    compress: true
  }))
});

if (gulpversion == 3) {
  gulp.task('watch', ['styles', 'scripts', 'browser-sync'], function() {
    gulp.watch(syntax+'/**/*.'+syntax+'', ['styles']);
    gulp.watch(['libs/**/*.js', 'js/common.js'], ['scripts']);
    gulp.watch(['*.html', '_site/**/*.html'], ['code'])
  });
  gulp.task('default', ['watch']);
}


if (gulpversion == 4) {
  gulp.task('watch', function() {
    gulp.watch(syntax+'/**/*.'+syntax+'', gulp.parallel('styles'));
    gulp.watch(['libs/**/*.js', 'js/common.js'], gulp.parallel('scripts'));
    gulp.watch(['*.html', '_site/**/*.html'], gulp.parallel('code'))
  });
  gulp.task('default', gulp.parallel('styles', 'scripts', 'browser-sync', 'watch'));
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question