|
| 1 | +************ |
| 2 | +Contributing |
| 3 | +************ |
1 | 4 |
|
2 | | -*********************************** |
3 | | -Contributing or modifying the theme |
4 | | -*********************************** |
| 5 | +This project follows the Read the Docs :doc:`code of conduct |
| 6 | +<rtd:code-of-conduct>`. If you are not familiar with our code of conduct policy, |
| 7 | +take a minute to read the policy before starting with your first contribution. |
5 | 8 |
|
6 | | -The sphinx_rtd_theme is primarily a sass_ project that requires a few other sass libraries. I'm |
7 | | -using bower_ to manage these dependencies and sass_ to build the css. The good news is |
8 | | -I have a very nice set of grunt_ operations that will not only load these dependencies, but watch |
9 | | -for changes, rebuild the sphinx demo docs and build a distributable version of the theme. |
10 | | -The bad news is this means you'll need to set up your environment similar to that |
11 | | -of a front-end developer (vs. that of a python developer). That means installing node and ruby. |
12 | | - |
13 | | -.. seealso:: |
| 9 | +Modifying the theme |
| 10 | +=================== |
14 | 11 |
|
15 | | - If you are unsure of appropriate actions to take while interacting with our |
16 | | - community please read our :doc:`Code of Conduct <rtd:code-of-conduct>`. |
| 12 | +The styles for this theme use SASS_ and a custom CSS framework called Wyrm_. We |
| 13 | +use Bower_ to manage these dependencies and SASS_ to build the CSS. Grunt_ is |
| 14 | +used to watch for changes, rebuild the static assets, and rebuild the Sphinx |
| 15 | +demo documentation. |
17 | 16 |
|
| 17 | +.. note:: |
| 18 | + The installation of Ruby and Node is outside the scope of this |
| 19 | + documentation. You will need both in order to make changes to this theme. |
18 | 20 |
|
19 | 21 | Set up your environment |
20 | | -======================= |
| 22 | +----------------------- |
21 | 23 |
|
22 | | -#. Install sphinx_ into a virtual environment. |
| 24 | +#. Install Sphinx_ and documentation build dependencies. |
23 | 25 |
|
24 | | - .. code:: bash |
| 26 | + .. code:: console |
25 | 27 |
|
26 | | - pip install sphinx sphinxcontrib-httpdomain |
| 28 | + pip install -e '.[dev]' |
27 | 29 |
|
28 | | -#. Install sass. |
| 30 | +#. Install SASS. |
29 | 31 |
|
30 | | - .. code:: bash |
| 32 | + .. code:: console |
31 | 33 |
|
32 | 34 | gem install sass |
33 | 35 |
|
34 | | -#. Install node, bower, grunt, and theme dependencies. |
35 | | - |
36 | | - .. code:: bash |
37 | | -
|
38 | | - # Install node |
39 | | - brew install node |
| 36 | +#. Install Bower, Grunt, and theme dependencies locally. |
40 | 37 |
|
41 | | - # Install bower and grunt |
42 | | - npm install -g bower grunt-cli |
| 38 | + .. code:: console |
43 | 39 |
|
44 | | - # Now that everything is installed, let's install the theme dependencies. |
45 | 40 | npm install |
46 | 41 |
|
47 | | -Now that our environment is set up, make sure you're in your virtual environment, go to |
48 | | -this repository in your terminal and run grunt: |
| 42 | +Making changes |
| 43 | +-------------- |
49 | 44 |
|
50 | | -.. code:: |
| 45 | +Changes to the theme can be compiled and tested with the default Grunt task: |
| 46 | + |
| 47 | +.. code:: console |
51 | 48 |
|
52 | 49 | grunt |
53 | 50 |
|
54 | | -This default task will do the following **very cool things that make it worth the trouble**: |
| 51 | +This default task will do the following: |
| 52 | + |
| 53 | +#. Install and update any Bower dependencies. |
| 54 | +#. Build the static CSS from SASS source files. |
| 55 | +#. Build the demo documentation. |
| 56 | +#. Watch for changes to the SASS files and documentation and rebuild everything |
| 57 | + on any detected changes. |
| 58 | + |
| 59 | +Alternatively, if you don't need to watch the files, Grunt can be called with |
| 60 | +the same task used for releases: |
| 61 | + |
| 62 | +.. code:: console |
| 63 | +
|
| 64 | + grunt build |
| 65 | +
|
| 66 | +.. _Bower: http://www.bower.io |
| 67 | +.. _SASS: http://www.sass-lang.com |
| 68 | +.. _Wyrm: http://www.github.com/snide/wyrm/ |
| 69 | +.. _Grunt: http://www.gruntjs.com |
| 70 | +.. _Sphinx: http://www.sphinx-doc.org/en/stable/ |
| 71 | + |
| 72 | +Translations |
| 73 | +============ |
| 74 | + |
| 75 | +Translations are managed using `Transifex`_. You can join any of the existing |
| 76 | +language teams or request a new language is added to the project. For more |
| 77 | +information on our translation standards, see our docs on |
| 78 | +:doc:`rtd:development/i18n` |
| 79 | + |
| 80 | +Periodically, core team should update the translation files outside our normal |
| 81 | +releases. Someone from the core team, with write access to Transifex, should run |
| 82 | +the following: |
| 83 | + |
| 84 | +.. code:: console |
55 | 85 |
|
56 | | -#. Install and update any bower dependencies. |
57 | | -#. Run sphinx and build new docs. |
58 | | -#. Watch for changes to the sass files and build css from the changes. |
59 | | -#. Rebuild the sphinx docs anytime it notices a change to ``.rst``, ``.html``, ``.js`` |
60 | | - or ``.css`` files. |
| 86 | + python setup.py update_translations |
61 | 87 |
|
62 | | -.. _bower: http://www.bower.io |
63 | | -.. _sass: http://www.sass-lang.com |
64 | | -.. _wyrm: http://www.github.com/snide/wyrm/ |
65 | | -.. _grunt: http://www.gruntjs.com |
66 | | -.. _node: http://www.nodejs.com |
67 | | -.. _sphinx: http://www.sphinx-doc.org/en/stable/ |
| 88 | +This will extract new messages, upload the messages to Transifex, and will |
| 89 | +update our local translation files. Changes can be checked in to a branch and |
| 90 | +put up for review. |
68 | 91 |
|
| 92 | +.. _Transifex: https://www.transifex.com/readthedocs/sphinx-rtd-theme |
69 | 93 |
|
70 | | -Releasing the Theme |
| 94 | +Releasing the theme |
71 | 95 | =================== |
72 | 96 |
|
73 | | -When you release a new version, |
74 | | -you should do the following: |
| 97 | +To release a new version of the theme, core team will take the following steps: |
75 | 98 |
|
76 | 99 | #. Bump the version in ``sphinx_rtd_theme/__init__.py``, ``bower.json`` and ``package.json`` -- |
77 | 100 | we try to follow `semver <http://semver.org/>`_, so be careful with breaking changes. |
78 | 101 | #. Update the changelog (``docs/changelog.rst``) with the version information. |
79 | | -#. Run a ``grunt build`` to rebuild all the theme assets. |
| 102 | +#. Run ``grunt build`` to rebuild all the theme assets. |
| 103 | +#. Run ``python setup.py update_translations`` to compile new translation files and update Transifex |
80 | 104 | #. Commit that change. |
81 | 105 | #. Tag the release in git: ``git tag $NEW_VERSION``. |
82 | 106 | #. Push the tag to GitHub: ``git push --tags origin``. |
83 | 107 | #. Upload the package to PyPI: |
84 | 108 |
|
85 | | - .. code:: bash |
| 109 | + .. code:: console |
86 | 110 |
|
87 | | - $ rm -rf dist/ |
88 | | - $ python setup.py sdist bdist_wheel |
89 | | - $ twine upload --sign --identity [email protected] dist/* |
| 111 | + rm -rf dist/ |
| 112 | + python setup.py sdist bdist_wheel |
| 113 | + twine upload --sign --identity [email protected] dist/* |
0 commit comments