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.

24 lines
603 B

  1. 'use strict'
  2. const LocalWebServer = require('../../../')
  3. const liveReload = require('koa-livereload')
  4. const DefaultStack = require('local-web-server-default-stack')
  5. class LiveReloadStack extends DefaultStack {
  6. addAll () {
  7. return this.addLogging('dev')
  8. .add({
  9. optionDefinitions: {
  10. name: 'live-reload', type: Boolean,
  11. description: 'Add live reload.'
  12. },
  13. middleware: function (options) {
  14. if (options['live-reload']) {
  15. return liveReload()
  16. }
  17. }
  18. })
  19. .addStatic()
  20. }
  21. }
  22. module.exports = LiveReloadStack