2015-05-02 01:21:25 +02:00
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/builds.rst">Edit me on GitHub</a></div>
|
|
|
|
|
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
.. _builds:
|
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
=================
|
|
|
|
Generating builds
|
|
|
|
=================
|
2014-12-07 00:53:17 +01:00
|
|
|
|
|
|
|
.. contents:: Table of Contents
|
|
|
|
:depth: 3
|
|
|
|
:local:
|
|
|
|
|
|
|
|
|
|
|
|
.. warning:: There current documentation in this section does not adequately
|
2018-09-18 10:53:43 +02:00
|
|
|
explain how to create custom bundles.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
.. Note:: Please make sure to read the section :doc:`development` and that you have installed
|
2015-02-05 15:58:51 +01:00
|
|
|
all development dependencies (long story short, you should be able to just run ``make dev``)
|
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
Creating JavaScript and CSS bundles and distribution files
|
|
|
|
==========================================================
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
Converse uses `webpack <https://webpack.js.org/>`_ to create bundles containing the
|
|
|
|
core JavaScript code and all of the 3rd party dependencies.
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
Similarly, we use `Sass <http://sass-lang.com/>`_ to generate the CSS bundle
|
|
|
|
from ``.scss`` files in the ``sass`` directory.
|
2016-09-23 10:54:55 +02:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
The generated JavaScript bundles are contained in the `dist <https://github.com/conversejs/converse.js/tree/master/dist>`_ directory
|
|
|
|
and the generated CSS bundles in the `css <https://github.com/conversejs/converse.js/tree/master/css>`_ directory.
|
2016-09-23 10:54:55 +02:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
To generate a prticular bundle, for example the minified file ``converse.min.js``, you can run ``make dist/converse.min.js``.
|
|
|
|
This is also true for any of the other bundle files.
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
To generate all CSS and JavaScript bundles, you can run ``make dist``.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
When you're developing, and constantly changing code, you can run ``make watch``
|
|
|
|
to let the bundles be automatically generated as soon as you edit a file.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
The Converse repository does not include the minified files in the ``dist`` or
|
|
|
|
``css`` directories. Before deployment, you'll want to generate them yourself.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-10-18 20:33:46 +02:00
|
|
|
To only generate the minified files, you can make them individually.
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
::
|
|
|
|
make dist/converse.min.js
|
|
|
|
make css/converse.min.css
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
Creating custom bundles
|
|
|
|
=======================
|
2017-01-20 10:18:18 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
One reason you might want to create your own bundles, is because you want to
|
|
|
|
remove some of the core plugins of Converse, or perhaps you want to include
|
2017-01-20 10:18:18 +01:00
|
|
|
your own.
|
|
|
|
|
|
|
|
To add or remove plugins from the build, you need to modify the
|
2018-09-18 10:53:43 +02:00
|
|
|
`src/converse.js <https://github.com/conversejs/converse.js/blob/master/src/converse.js>`_ file.
|
2017-01-20 10:18:18 +01:00
|
|
|
|
|
|
|
You'll find a section marked ``/* START: Removable components`` and
|
|
|
|
``/* END: Removable components */``.
|
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
In this section is listed the Converse plugins that will make up a bundle.
|
2017-01-20 10:18:18 +01:00
|
|
|
|
|
|
|
You could for example decide to disable the ControlBox altogether by removing
|
|
|
|
the ``converse-controlbox`` plugin.
|
|
|
|
|
|
|
|
After doing so, you need to run ``make dist`` again in the root or your
|
2018-09-18 10:53:43 +02:00
|
|
|
Converse repository, in order to generate the new build.
|
2017-01-20 10:18:18 +01:00
|
|
|
|
|
|
|
Be aware that some plugins might have dependencies on other plugins, so if you
|
|
|
|
remove a certain plugin but other included plugins still depend on it, then it
|
|
|
|
will still be included in your build.
|
|
|
|
|
|
|
|
To see which other plugins a particular plugin depends on, open it up in your
|
|
|
|
text editor and look at the list specified as the second parameter to the
|
|
|
|
``define`` call, near the top of the file. This list specifies the dependencies
|
|
|
|
of that plugin.
|
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
Besides the standard build, the Converse repository includes configuration
|
|
|
|
for certain other non-standard builds, which we'll now mention below.
|
|
|
|
|
|
|
|
Excluding all 3rd party dependencies
|
|
|
|
------------------------------------
|
|
|
|
|
|
|
|
The ``dist/converse-no-dependencies.js`` bundle contains only the core Converse
|
|
|
|
code and none of the 3rd party dependencies. This might be useful if you need
|
|
|
|
to load the dependencies separately.
|
|
|
|
|
|
|
|
To generate this bundle, you can run:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
make dist/converse-no-dependencies.js
|
|
|
|
make dist/converse-no-dependencies.min.js
|
|
|
|
|
|
|
|
Headless build
|
|
|
|
--------------
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
There is also the option of making a headless build of Converse.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
This is a build without any UI code but still containing the core functionality of
|
|
|
|
maintaining a roster, chats and messages.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2018-09-18 10:53:43 +02:00
|
|
|
The file `src/headless.js <https://github.com/jcbrand/converse.js/blob/master/src/headless.js>`_
|
|
|
|
is used to determine which plugins are included in the build.
|