gulpfile.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Include gulp
  2. var gulp = require('gulp');
  3. // Include our plugins
  4. var jshint = require('gulp-jshint');
  5. var bootlint = require('gulp-bootlint');
  6. var uglify = require('gulp-uglify');
  7. var rename = require('gulp-rename');
  8. var bootlint = require('gulp-bootlint');
  9. var html5lint = require('gulp-html5-lint');
  10. var checkPages = require('check-pages');
  11. // Default task
  12. gulp.task('default', ['js', 'html', 'bootstrap', 'links', 'minify']);
  13. // Lint our JavaScript files
  14. gulp.task('js', function () {
  15. return gulp.src('src/**/*.js')
  16. .pipe(jshint())
  17. .pipe(jshint.reporter('default'));
  18. });
  19. gulp.task('html', function () {
  20. return gulp.src(['*.html', 'examples/*.html'])
  21. .pipe(html5lint());
  22. });
  23. // Lint our Bootstrap files
  24. gulp.task('bootstrap', function () {
  25. return gulp.src(['*.html', 'examples/**/*.html'])
  26. .pipe(bootlint());
  27. });
  28. // Check for broken and invalid links in the web pages
  29. gulp.task('links', function (callback) {
  30. var options = {
  31. pageUrls: [
  32. 'index.html',
  33. 'examples/basic.html',
  34. 'examples/clear-formatting.html',
  35. 'examples/events.html',
  36. 'examples/form-post.html',
  37. 'examples/formatblock-example.html',
  38. 'examples/html-editor.html',
  39. 'examples/multiple-editors.html',
  40. 'examples/simple-toolbar.html'
  41. ],
  42. checkLinks: true,
  43. summary: true
  44. };
  45. checkPages(console, options, callback);
  46. });
  47. // Minify our JS
  48. gulp.task('minify', function () {
  49. return gulp.src('src/*.js')
  50. .pipe(uglify())
  51. .pipe(rename('bootstrap-wysiwyg.min.js'))
  52. .pipe(gulp.dest('js'));
  53. });
  54. // Watch files for changes
  55. gulp.task('watch', function () {
  56. gulp.watch(['src/*.js', 'index.html', 'examples/*.html'], ['js', 'html', 'bootstrap', 'links', 'minify']);
  57. });