Guest User

Untitled

a guest
Apr 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. import { src, dest, watch, series, parallel } from 'gulp';
  2. import plumber from 'gulp-plumber';
  3. import stylus from 'gulp-stylus';
  4. import postcss from 'gulp-postcss';
  5. import autoprefixer from 'autoprefixer';
  6. import lost from 'lost';
  7. import rupture from 'rupture';
  8. import cssnano from 'cssnano';
  9. import pug from 'gulp-pug';
  10. import babel from 'gulp-babel';
  11. import concat from 'gulp-concat';
  12. import uglify from 'gulp-uglify';
  13. import imagemin from 'gulp-imagemin';
  14. import svgmin from 'gulp-svgmin';
  15. import { stream, init } from 'browser-sync';
  16. import del from 'del';
  17.  
  18. export const clear = () => del('./dist');
  19.  
  20. export const live = () => init({
  21. server: './dist',
  22. });
  23.  
  24. export const pages = () => src('./src/pages/*.pug')
  25. .pipe(plumber())
  26. .pipe(pug())
  27. .pipe(dest('./dist'))
  28. .pipe(stream());
  29.  
  30. export const styles = () => src('./src/assets/styles/style.styl')
  31. .pipe(plumber())
  32. .pipe(stylus())
  33. .pipe(postcss([
  34. rupture(),
  35. lost(),
  36. autoprefixer(),
  37. cssnano(),
  38. ]))
  39. .pipe(dest('./dist/assets/css'))
  40. .pipe(stream());
  41.  
  42. export const scripts = () => src('./src/assets/scripts/*.js')
  43. .pipe(plumber())
  44. .pipe(babel())
  45. .pipe(concat('script.js'))
  46. .pipe(uglify())
  47. .pipe(dest('./dist/assets/js'))
  48. .pipe(stream());
  49.  
  50. export const images = () => src('./src/assets/images/**/*')
  51. .pipe(plumber())
  52. .pipe(imagemin())
  53. .pipe(dest('./dist/assets/img'))
  54. .pipe(stream());
  55.  
  56. export const vectors = () => src('./src/assets/vectors/**/*')
  57. .pipe(svgmin())
  58. .pipe(dest('./dist/assets/svg'))
  59. .pipe(stream());
  60.  
  61. export const eyes = () => {
  62. watch('./src/assets/styles/**/*', styles);
  63. watch('./src/assets/scripts/**/*', scripts);
  64. watch('./src/assets/images/**/*', images);
  65. watch('./src/assets/vectors/**/*', vectors);
  66. watch('./src/pages/**/*', pages);
  67. };
  68.  
  69. export const build = parallel(pages, styles, scripts, images, vectors);
  70.  
  71. export const server = series(clear, build, parallel(live, eyes));
Add Comment
Please, Sign In to add comment