mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
doc: Add explanation for the priority attribute of html_*_files
This commit is contained in:
parent
1b7d16505e
commit
e9a4ebf70d
@ -1001,7 +1001,14 @@ that use Sphinx's HTMLWriter class.
|
||||
'https://example.com/css/custom.css',
|
||||
('print.css', {'media': 'print'})]
|
||||
|
||||
As a special attribute, *priority* can be set as an integer to load the CSS
|
||||
file earlier or lazier step. For more information, refer
|
||||
:meth:`Sphinx.add_css_files()`.
|
||||
|
||||
.. versionadded:: 1.8
|
||||
.. versionchanged:: 3.5
|
||||
|
||||
Support priority attribute
|
||||
|
||||
.. confval:: html_js_files
|
||||
|
||||
@ -1017,7 +1024,14 @@ that use Sphinx's HTMLWriter class.
|
||||
'https://example.com/scripts/custom.js',
|
||||
('custom.js', {'async': 'async'})]
|
||||
|
||||
As a special attribute, *priority* can be set as an integer to load the CSS
|
||||
file earlier or lazier step. For more information, refer
|
||||
:meth:`Sphinx.add_css_files()`.
|
||||
|
||||
.. versionadded:: 1.8
|
||||
.. versionchanged:: 3.5
|
||||
|
||||
Support priority attribute
|
||||
|
||||
.. confval:: html_static_path
|
||||
|
||||
|
@ -4,7 +4,9 @@ version = '1.4.4'
|
||||
html_static_path = ['static', 'subdir']
|
||||
html_extra_path = ['extra', 'subdir']
|
||||
html_css_files = ['css/style.css',
|
||||
('https://example.com/custom.css', {'title': 'title', 'media': 'print'})]
|
||||
('https://example.com/custom.css',
|
||||
{'title': 'title', 'media': 'print', 'priority': 400})]
|
||||
html_js_files = ['js/custom.js',
|
||||
('https://example.com/script.js', {'async': 'async'})]
|
||||
('https://example.com/script.js',
|
||||
{'async': 'async', 'priority': 400})]
|
||||
exclude_patterns = ['**/_build', '**/.htpasswd']
|
||||
|
@ -1244,15 +1244,15 @@ def test_assets_order(app):
|
||||
|
||||
# css_files
|
||||
expected = ['_static/pygments.css', '_static/alabaster.css', '_static/early.css',
|
||||
'_static/normal.css', '_static/late.css', '_static/css/style.css',
|
||||
'https://example.com/custom.css', '_static/lazy.css']
|
||||
'https://example.com/custom.css', '_static/normal.css', '_static/late.css',
|
||||
'_static/css/style.css', '_static/lazy.css']
|
||||
pattern = '.*'.join('href="%s"' % f for f in expected)
|
||||
assert re.search(pattern, content, re.S)
|
||||
|
||||
# js_files
|
||||
expected = ['_static/early.js', '_static/jquery.js', '_static/underscore.js',
|
||||
'_static/doctools.js', '_static/normal.js', '_static/late.js',
|
||||
'_static/js/custom.js', 'https://example.com/script.js', '_static/lazy.js']
|
||||
'_static/doctools.js', 'https://example.com/script.js', '_static/normal.js',
|
||||
'_static/late.js', '_static/js/custom.js', '_static/lazy.js']
|
||||
pattern = '.*'.join('src="%s"' % f for f in expected)
|
||||
assert re.search(pattern, content, re.S)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user