Skip to content

Commit

Permalink
Merge pull request #2 from IATI/add-npm
Browse files Browse the repository at this point in the history
Add IATI design system
  • Loading branch information
tillywoodfield authored May 29, 2024
2 parents 0498472 + 4653a64 commit 1100291
Show file tree
Hide file tree
Showing 12 changed files with 393 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.ve
__pycache__
dist

# Node
node_modules
5 changes: 5 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ build:
os: ubuntu-22.04
tools:
python: "3.10"
nodejs: "20"
jobs:
pre_install:
- npm ci
- npm run build

sphinx:
configuration: docs/conf.py
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
## Development

### Install dependencies

```
pip install -r requirements_dev.txt
```

### Update dependencies

```
python -m piptools compile --extra=dev -o requirements_dev.txt pyproject.toml
pip install -r requirements_dev.txt
Expand All @@ -23,12 +25,15 @@ flake8 iati_sphinx_theme

### Documentation with live preview

1. Install the theme locally:
```
pip install -e .
```
1. In one terminal, build the CSS in watch mode

```
npm run build:watch
```

2. In a separate terminal, install the Sphinx theme then start the docs development server:

2. Start the docs development server:
```
sphinx-autobuild docs docs/_build/html
```
```
pip install -e .
sphinx-autobuild -a docs docs/_build/html --watch iati_sphinx_theme/
```
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "iati_sphinx_theme"
html_static_path = ["_static"]
todo_include_todos = True
2 changes: 1 addition & 1 deletion docs/kitchen-sink/generic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ References
==========

Footnotes
~~~~~~~~~~~
---------

Here we have a footnote. [#doubleColon]_

Expand Down
2 changes: 2 additions & 0 deletions iati_sphinx_theme/static/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Autogenerated CSS
iati.css
2 changes: 2 additions & 0 deletions iati_sphinx_theme/theme.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[theme]
inherit = basic
stylesheet = iati.css
pygments_style = default
247 changes: 247 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "sphinx-theme",
"scripts": {
"build": "sass --pkg-importer=node --style=expanded --no-source-map styles/main.scss:iati_sphinx_theme/static/iati.css",
"build:watch": "npm run build -- --watch"
},
"devDependencies": {
"iati-design-system": "1.0.0",
"sass": "^1.75.0"
}
}
39 changes: 39 additions & 0 deletions styles/_admonitions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@use "pkg:iati-design-system" as ds;

.admonition,
.topic,
.versionadded,
.versionchanged,
div.deprecated {
@extend .iati-callout;
}

.admonition-title,
.topic-title {
@extend .iati-callout__title;
}

.attention,
.caution,
.warning,
.versionchanged {
@extend .iati-callout--orange;
}

.danger,
.error,
div.deprecated {
@extend .iati-callout--red;
}

.versionadded {
@extend .iati-callout--green;
}

.tip {
@extend .iati-callout--purple;
}

.versionmodified {
font-weight: bold;
}
Loading

0 comments on commit 1100291

Please sign in to comment.