Advertisement
Guest User

Untitled

a guest
May 14th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. const gulp = require('gulp');
  2. const browserSync = require('browser-sync').create();
  3. const sass = require('gulp-sass');
  4. const autoprefixer = require('gulp-autoprefixer');
  5. const concat = require('gulp-concat');
  6. const rename = require('gulp-rename');
  7. const uglify = require('gulp-uglify');
  8. const babel = require('gulp-babel');
  9. const gutil = require('gutil');
  10. const ftp = require('vinyl-ftp');
  11.  
  12.  
  13.  
  14. var localFiles = [
  15. './dist/js/*.js',
  16. './dist/css/*.css'
  17. ];
  18.  
  19. function getFtpConnection(){
  20. return ftp.create({
  21. host: '163.172.255.114',
  22. port: 21,
  23. user: 'carismaclassic_developer',
  24. password: 'osQPfh4fCu',
  25. log: gutil.log
  26. });
  27. }
  28.  
  29.  
  30.  
  31. const remoteLocation = '/public_html/wp-content/themes/classiccarsmadrid/assets/';
  32. gulp.task('remote-deploy', function(){
  33. const conn = getFtpConnection();
  34. return gulp.src(localFiles, {base: '.', buffer: false})
  35. .pipe(conn.newer(remoteLocation))
  36. .pipe(conn.dest(remoteLocation))
  37. });
  38.  
  39.  
  40. gulp.task('scripts-lib', function () {
  41. const conn = getFtpConnection();
  42. return gulp.src([
  43. './js/jquery-3.1.1.min.js',
  44. './js/jquery.fancybox.min.js',
  45. './js/jquery.nice-select.min.js',
  46. './js/owl.carousel.min.js',
  47. './js/map.js',
  48. './js/slaider_blog.js',
  49. './js/slaider_video.js',
  50. './js/script.js',
  51. ])
  52. // .pipe(uglify())
  53. .pipe(concat('app.min.js'))
  54. .pipe(gulp.dest('./dist/js/'));
  55. // .pipe(conn.dest(remoteLocation + '/dist/js/'));
  56. });
  57.  
  58. // gulp.task('sass', function () {
  59. // const conn = getFtpConnection();
  60. // return gulp.src("./scss/*.scss")
  61. // .pipe(sass({outputStyle: 'compressed'}))
  62. // .pipe(autoprefixer({
  63. // browsers: [
  64. // 'last 2 versions',
  65. // 'ie 9',
  66. // 'android 2.3',
  67. // 'android 4',
  68. // 'opera 12'
  69. // ],
  70. // cascade: false
  71. // }))
  72. // .pipe(rename('app.min.css'))
  73. // .pipe(gulp.dest("./dist/css"));
  74. // // .pipe(conn.dest(remoteLocation + '/dist/css/'))
  75. // // .pipe(browserSync.stream());
  76. // });
  77.  
  78. gulp.task('serve', ['scripts-lib'], function () {
  79. gulp.watch("./js/*.js", ['scripts-lib']);
  80. // gulp.watch("./scss/**/*.scss", ['sass']);
  81. // gulp.watch("./scss/*.scss", ['sass']);
  82. });
  83. gulp.task('default', ['serve']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement