builds.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. .. raw:: html
  2. <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/builds.rst">Edit me on GitHub</a></div>
  3. .. _builds:
  4. =================
  5. Generating builds
  6. =================
  7. .. contents:: Table of Contents
  8. :depth: 3
  9. :local:
  10. .. warning:: There current documentation in this section does not adequately
  11. explain how to create custom bundles.
  12. .. Note:: Please make sure to read the section :doc:`development` and that you have installed
  13. all development dependencies (long story short, you should be able to just run ``make dev``)
  14. Creating JavaScript and CSS bundles and distribution files
  15. ==========================================================
  16. Converse uses `webpack <https://webpack.js.org/>`_ to create single build files containing the core code and
  17. all of the 3rd party dependencies.
  18. These files are in the `dist <https://github.com/conversejs/converse.js/tree/master/dist>`_ directory.
  19. Before you start changing the core code, you can run ``make watchjs`` in your terminal.
  20. This command will listen for any changed files and then automatically create a
  21. new build of ``dist/converse.js``.
  22. The CSS files are also generated, from the scss files in the
  23. `sass <https://github.com/conversejs/converse.js/tree/master/sass>`_ directory.
  24. Similarly to ``make watchjs``, you can run ``make watch`` to automatically
  25. generate the css files in the ``./css/`` directory.
  26. The Converse repository does not include the minified files in the ``dist`` or
  27. ``css`` directories. Before deployment, you'll want to generate them yourself.
  28. To do so, run the following:
  29. ::
  30. make dist/converse.min.js
  31. make css/converse.min.css
  32. Alternatively, if you want to generate ALL the bundles files (minified and
  33. unminified), then you can also run::
  34. make dist
  35. Creating custom bundles
  36. =======================
  37. One reason you might want to create your own bundles, is because you want to
  38. remove some of the core plugins of Converse, or perhaps you want to include
  39. your own.
  40. To add or remove plugins from the build, you need to modify the
  41. `src/converse.js <https://github.com/conversejs/converse.js/blob/master/src/converse.js>`_ file.
  42. You'll find a section marked ``/* START: Removable components`` and
  43. ``/* END: Removable components */``.
  44. In this section is listed the Converse plugins that will make up a bundle.
  45. You could for example decide to disable the ControlBox altogether by removing
  46. the ``converse-controlbox`` plugin.
  47. After doing so, you need to run ``make dist`` again in the root or your
  48. Converse repository, in order to generate the new build.
  49. Be aware that some plugins might have dependencies on other plugins, so if you
  50. remove a certain plugin but other included plugins still depend on it, then it
  51. will still be included in your build.
  52. To see which other plugins a particular plugin depends on, open it up in your
  53. text editor and look at the list specified as the second parameter to the
  54. ``define`` call, near the top of the file. This list specifies the dependencies
  55. of that plugin.
  56. Besides the standard build, the Converse repository includes configuration
  57. for certain other non-standard builds, which we'll now mention below.
  58. Excluding all 3rd party dependencies
  59. ------------------------------------
  60. The ``dist/converse-no-dependencies.js`` bundle contains only the core Converse
  61. code and none of the 3rd party dependencies. This might be useful if you need
  62. to load the dependencies separately.
  63. To generate this bundle, you can run:
  64. ::
  65. make dist/converse-no-dependencies.js
  66. make dist/converse-no-dependencies.min.js
  67. Headless build
  68. --------------
  69. There is also the option of making a headless build of Converse.
  70. This is a build without any UI code but still containing the core functionality of
  71. maintaining a roster, chats and messages.
  72. The file `src/headless.js <https://github.com/jcbrand/converse.js/blob/master/src/headless.js>`_
  73. is used to determine which plugins are included in the build.
  74. .. Note:: Unfortunately it's currently not yet possible to include Multi-user chat (MUC)
  75. functionality in the headless build. This is because both the UI and core
  76. functionality is still contained in one plugin and would first need to be
  77. split up into two parts, with the UI part dropped for this build.