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:
|
|
|
|
|
|
|
|
===============
|
|
|
|
Creating 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
|
|
|
|
explain how to create custom builds.
|
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
.. note:: Please make sure to read the section :doc:`development` and that you have installed
|
|
|
|
all development dependencies (long story short, you should be able to just run ``make dev``)
|
|
|
|
|
2016-02-28 10:00:22 +01:00
|
|
|
Creating builds and distribution files
|
|
|
|
======================================
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2016-09-23 10:54:55 +02:00
|
|
|
Converse.js uses `AMD (Asynchronous Modules Definition) <http://requirejs.org/docs/whyamd.html#amd>`_
|
|
|
|
to define modules and their dependencies.
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2016-09-23 10:54:55 +02:00
|
|
|
Dependencies can then be loaded on-the-fly with `require.js <http://requirejs.org>`_.
|
|
|
|
This is very useful during development, but when it comes to
|
|
|
|
deployement, it's usually desired to create a single, minified distribution build.
|
|
|
|
|
|
|
|
For this, the `r.js optimizer <http://requirejs.org/docs/optimization.html>`_
|
|
|
|
is used together with `almond.js <https://github.com/requirejs/almond>`_, which
|
|
|
|
is a minimal AMD API implementation that replaces require.js in builds (in
|
|
|
|
order to keep the build smaller).
|
|
|
|
|
|
|
|
To create the distribution build, simply run::
|
2015-02-05 15:58:51 +01:00
|
|
|
|
2016-02-28 10:00:22 +01:00
|
|
|
make dist
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
This command does the following:
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2016-09-23 10:54:55 +02:00
|
|
|
* It creates different builds of Converse.js in the ``./dist/`` directory.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
* It bundles all the translation files in ``./locale/`` into a single file ``locales.js``.
|
|
|
|
This file can then be included via the ``<script>`` tag. See for example the ``non_amd.html`` example page.
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
* Also, the CSS files in the ``./css`` directory will be minified.
|
|
|
|
|
2016-09-23 10:54:55 +02:00
|
|
|
The Javascript build files are contained in the ``./dist`` directory:
|
2015-02-05 15:58:51 +01:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2016-02-28 10:00:22 +01:00
|
|
|
jc@conversejs:~/converse.js (master)$ ls dist/
|
2016-09-23 10:54:55 +02:00
|
|
|
converse-mobile.js converse.min.js
|
|
|
|
converse-mobile.min.js converse.nojquery.js
|
|
|
|
converse-no-dependencies.js converse.nojquery.min.js
|
|
|
|
converse-no-dependencies.min.js locales.js
|
|
|
|
converse.js
|
2015-02-05 15:58:51 +01:00
|
|
|
|
|
|
|
.. _`minification`:
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
Minifying the CSS
|
|
|
|
-----------------
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
To only minify the CSS files, nothing else, run the following command::
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
make cssmin
|
2014-12-07 00:53:17 +01:00
|
|
|
|
2015-02-05 15:58:51 +01:00
|
|
|
The CSS files are minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
|
2014-12-07 00:53:17 +01:00
|
|
|
|