gulpfile.js 966 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var gulp = require('gulp');
  2. var path = require('path');
  3. var $ = require('gulp-load-plugins')();
  4. var webpackConfig = require('./webpack.config.js');
  5. var port = 5555;
  6. var dist = 'dist/';
  7. gulp.task('styles', function(){
  8. return gulp.src(['../node_modules/simplemde/dist/simplemde.min.css'])
  9. .pipe($.concat('vendor.css'))
  10. .pipe(gulp.dest(dist + 'stylesheets/'))
  11. });
  12. gulp.task('scripts', function() {
  13. return gulp.src(webpackConfig.entry)
  14. .pipe($.webpack(webpackConfig))
  15. .pipe(gulp.dest(dist + 'js/'))
  16. .pipe($.connect.reload());
  17. });
  18. gulp.task('serve', function() {
  19. $.connect.server({
  20. root: dist,
  21. port: port,
  22. livereload: {
  23. port: 35729
  24. }
  25. });
  26. });
  27. gulp.task('watch', function() {
  28. gulp.watch('./scripts/**/*.js', ['scripts']);
  29. gulp.watch('../src/**/*.js', ['scripts']);
  30. });
  31. // by default build project and then watch files in order to trigger livereload
  32. gulp.task('default', ['scripts', 'styles', 'serve', 'watch']);