dev.js 812 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const debug = require('debug')('crowi:crowi:dev');
  2. const path = require('path');
  3. const webpack = require('webpack');
  4. const helpers = require('./helpers')
  5. class CrowiDev {
  6. /**
  7. * Creates an instance of CrowiDev.
  8. * @param {Crowi} crowi
  9. * @param {any} server http server
  10. * @param {any} app express
  11. *
  12. * @memberOf CrowiDev
  13. */
  14. constructor(crowi, server, app) {
  15. this.crowi = crowi;
  16. this.server = server;
  17. this.app = app;
  18. }
  19. setupTools() {
  20. this.setupEasyLiveReload();
  21. }
  22. setupEasyLiveReload() {
  23. const livereload = require('easy-livereload');
  24. this.app.use(livereload({
  25. watchDirs: [
  26. path.join(this.crowi.viewsDir),
  27. ],
  28. checkFunc: function(x) {
  29. return /\.(html|css|js)$/.test(x);
  30. },
  31. }));
  32. }
  33. }
  34. module.exports = CrowiDev