connections.plugin.js 863 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. var connections = require("./lib/connections");
  2. const PLUGIN_NAME = "Connections";
  3. /**
  4. * @type {{plugin: Function, plugin:name: string, markup: string}}
  5. */
  6. module.exports = {
  7. /**
  8. * @param {UI} ui
  9. * @param {BrowserSync} bs
  10. */
  11. "plugin": function (ui, bs) {
  12. connections.init(ui, bs);
  13. },
  14. /**
  15. * Hooks
  16. */
  17. "hooks": {
  18. "client:js": fileContent("/connections.client.js"),
  19. "templates": [
  20. getPath("/connections.directive.html")
  21. ]
  22. },
  23. /**
  24. * Plugin name
  25. */
  26. "plugin:name": PLUGIN_NAME
  27. };
  28. /**
  29. * @param filepath
  30. * @returns {*}
  31. */
  32. function getPath (filepath) {
  33. return require("path").join(__dirname, filepath);
  34. }
  35. /**
  36. * @param filepath
  37. * @returns {*}
  38. */
  39. function fileContent (filepath) {
  40. return require("fs").readFileSync(getPath(filepath), "utf-8");
  41. }