SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var gulp = require('gulp');  
  2. var sass = require('gulp-sass');  
  3. var browserSync = require('browser-sync');
  4. var reload = browserSync.reload;
  5. var minifycss = require('gulp-minify-css');
  6. var concat = require('gulp-concat');
  7. var rename = require('gulp-rename');
  8. var uglify = require('gulp-uglify');
  9.  
  10. gulp.task('scripts', function() {
  11.   return gulp.src([
  12.     /* Add your JS files here, they will be combined in this order */
  13.     'src/js/main.js',
  14.     'src/js/other.js'
  15.  
  16.     ])
  17.     .pipe(concat('scripts.js'))
  18.     .pipe(gulp.dest('js'))
  19.     .pipe(rename({suffix: '.min'}))
  20.     .pipe(uglify())
  21.     .pipe(gulp.dest('./js'));
  22. });
  23.  
  24. gulp.task('sass', function () {  
  25.     gulp.src('src/scss/main.scss')
  26.         .pipe(sass({includePaths: ['scss']}))
  27.         .pipe(gulp.dest('./css'))
  28.         .pipe(minifycss());
  29. });
  30. gulp.task('html', function () {  
  31.     gulp.src('./*.html')
  32.         .pipe(gulp.dest('./'));
  33. });
  34. gulp.task('browser-sync', function() {  
  35.     browserSync.init(["css/*.css", "js/*.js"], {
  36.         server: {
  37.             baseDir: "./"
  38.         }
  39.     });
  40. });
  41.  
  42. gulp.task('default', ['sass', 'browser-sync'], function () {  
  43.     gulp.watch("src/scss/**/*.scss", ['sass']).on("change", reload);
  44.     gulp.watch("./*.html", ['html']).on("change", reload);
  45.     gulp.watch("src/js/*.js", ['scripts']).on("change", reload);
  46. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top