SHARE
TWEET

Untitled

a guest Jun 19th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Gulp
  2. const gulp = require('gulp');
  3.  
  4. // Sass/CSS
  5. var sass = require('gulp-sass');
  6. var sourcemaps = require('gulp-sourcemaps');
  7. const autoprefixer = require('gulp-autoprefixer');
  8. var cssmin = require('gulp-cssmin');
  9. var rename = require('gulp-rename');
  10.  
  11. // JavaScript
  12. var uglify = require('gulp-uglify');
  13.  
  14. // Drush
  15. var shell = require('gulp-shell');
  16.  
  17. // BrowserSync
  18. var browserSync = require('browser-sync').create();
  19.  
  20. // compile all your Sass
  21. gulp.task('sass', function (){
  22.   gulp.src(['scss/**/*.scss'])
  23.   // Write inline source maps
  24.     .pipe(sourcemaps.init())
  25.     //Sass plugin for Gulp.
  26.     .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
  27.     // Prefix CSS with Autoprefixer
  28.     .pipe(autoprefixer({
  29.       browsers: ['last 2 versions'],
  30.       cascade: false
  31.     }))
  32.     // Minify css and rename using gulp.
  33.     .pipe(cssmin())
  34.     //.pipe(rename({suffix: '.min'}))
  35.     // End sourcemaps + define destination
  36.     .pipe(sourcemaps.write())
  37.     .pipe(gulp.dest('css'));
  38. });
  39.  
  40. // Uglify JS
  41. gulp.task('js', function(){
  42.   gulp.src('js/*.js')
  43.     /*.pipe(uglify())
  44.     .pipe(rename({ suffix: '.min' }))
  45.     .pipe(gulp.dest('js'))*/
  46. });
  47.  
  48. // Run drush to clear cache.
  49. gulp.task('drush', shell.task([
  50.   //'drush cache-clear theme-registry',
  51.   //'drush cache-clear css-js'
  52. ]));
  53.  
  54. // Browsersync
  55. gulp.task('browser-sync', function() {
  56.   browserSync.init({
  57.     proxy: "dev.carperfection.be"
  58.   });
  59. });
  60.  
  61. // Default task to be run with `gulp`
  62. gulp.task('default', ['sass', 'js', 'drush', 'browser-sync'], function () {
  63.   gulp.watch("scss/**/*.scss", ['sass']);
  64.   gulp.watch("js/*.js", ['js']);
  65. });
RAW Paste Data
Top