No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gulpfile.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. var gulp = require('gulp');
  3. var cleanCSS = require('gulp-clean-css');
  4. var uglify = require('gulp-uglify');
  5. var concat = require('gulp-concat');
  6. var header = require('gulp-header');
  7. var buffer = require('vinyl-buffer');
  8. var pkg = require('./package.json');
  9. var eslint = require('gulp-eslint');
  10. var browserify = require('browserify');
  11. var source = require('vinyl-source-stream');
  12. var rename = require('gulp-rename');
  13. var banner = ['/**',
  14. ' * <%= pkg.name %> v<%= pkg.version %>',
  15. ' * Copyright <%= pkg.author %>',
  16. ' * @link <%= pkg.repository.url %>',
  17. ' * @license <%= pkg.license %>',
  18. ' */',
  19. ''].join('\n');
  20. function lint() {
  21. return gulp.src('./src/js/**/*.js')
  22. .pipe(eslint())
  23. .pipe(eslint.format())
  24. .pipe(eslint.failAfterError());
  25. }
  26. function scripts() {
  27. return browserify({entries: './src/js/easymde.js', standalone: 'EasyMDE'}).bundle()
  28. .pipe(source('easymde.min.js'))
  29. .pipe(buffer())
  30. .pipe(uglify())
  31. .pipe(header(banner, {pkg: pkg}))
  32. .pipe(gulp.dest('./dist/'));
  33. }
  34. function styles() {
  35. var css_files = [
  36. './node_modules/codemirror/lib/codemirror.css',
  37. './src/css/*.css',
  38. './node_modules/codemirror-spell-checker/src/css/spell-checker.css',
  39. ];
  40. return gulp.src(css_files)
  41. .pipe(concat('easymde.css'))
  42. .pipe(cleanCSS())
  43. .pipe(rename('easymde.min.css'))
  44. .pipe(buffer())
  45. .pipe(header(banner, {pkg: pkg}))
  46. .pipe(gulp.dest('./dist/'));
  47. }
  48. var build = gulp.parallel(gulp.series(lint, scripts), styles);
  49. gulp.task('default', build);