Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nicer Development Experience, take 2 #177

Merged
merged 3 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ dmypy.json
# VS Code
.vscode/

# Auto-generated docs page
docs/contributing-ebp.md
# Auto-generated CSS
sphinx-book-theme.css
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ repos:
hooks:
- id: black

- repo: local
- repo: https://github.com/mgedmin/check-manifest
rev: "0.39"
hooks:
- id: scss
name: boussole
types: [scss]
language: python
additional_dependencies: [boussole]
entry: boussole compile --config=.boussole.json
pass_filenames: false
- id: check-manifest
24 changes: 24 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
exclude .binder
recursive-exclude .binder *
exclude docs
recursive-exclude docs *
exclude tests
recursive-exclude tests *

exclude .flake8
exclude .pre-commit-config.yaml
exclude .readthedocs.yml
exclude .boussole.json
exclude noxfile.py

include CHANGELOG.md
include LICENSE
include MANIFEST.in
include README.md

include sphinx_book_theme/theme.conf
recursive-include sphinx_book_theme *.html
recursive-include sphinx_book_theme *.js
recursive-include sphinx_book_theme *.png
recursive-include sphinx_book_theme *.scss
recursive-include sphinx_book_theme *.svg
11 changes: 0 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,3 @@
# "extra_navbar": "<a href='https://google.com'>Test</a>",
}
html_baseurl = "https://sphinx-book-theme.readthedocs.io/en/latest/"

# -- Custom configuration ---------------------------------------------------


# Always regenerate the index page, to ensure assets are correctly copied.
def env_get_outdated(app, env, added, changed, removed):
return ["index"]


def setup(app):
app.connect("env-get-outdated", env_get_outdated)
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ def docs_live(session):
# open the browser after 5 seconds
"--open-browser",
# sphinx-build arguments
"-b", "html", "docs", "docs/_build/html",
"-a", "-b", "html", "docs", "docs/_build/html",
)
# fmt: on
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@
package_data={
"sphinx_book_theme": [
"theme.conf",
# Templates
"*.html",
"topbar/*.html",
# Stylesheets
"scss/*",
# Other static files
"static/*",
"static/images/*",
"topbar/*.html",
]
},
include_package_data=True,
Expand Down
9 changes: 8 additions & 1 deletion sphinx_book_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from docutils import nodes
from sphinx.util import logging
from bs4 import BeautifulSoup as bs

from sass import compile as sass_compile

from .launch import add_hub_urls

Expand All @@ -22,6 +22,13 @@ def add_static_path(app):
static_path = Path(__file__).parent.joinpath("static").absolute()
app.config.html_static_path.append(str(static_path))

# Compile the css file if it's not been compiled already
compiled_css_file = static_path / "sphinx-book-theme.css"
if not compiled_css_file.exists():
source_dir = str(static_path.parent / "scss")
output_dir = str(static_path)
sass_compile(dirname=(source_dir, output_dir), output_style="compressed")


def find_url_relative_to_root(pagename, relative_page, path_docs_source):
"""Given the current page (pagename), a relative page to it (relative_page),
Expand Down
1 change: 0 additions & 1 deletion sphinx_book_theme/static/sphinx-book-theme.css

This file was deleted.