mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Change webassets configuration for relative urls.
Set the ASSET_URL to be relative to the 'theme/' url, which requires to use
{{ SITEURL }}/{{ ASSET_URL }} in the template and make it works with both
relative and absolute urls.
This commit is contained in:
parent
67af48eed4
commit
f413a8da79
4 changed files with 17 additions and 25 deletions
|
|
@ -81,12 +81,16 @@ class TestWebAssets(unittest.TestCase):
|
|||
def test_template(self):
|
||||
"""Look in the output index.html file for the link tag."""
|
||||
|
||||
css_file = 'theme/gen/style.{0}.min.css'.format(self.version)
|
||||
css_file = './theme/gen/style.{0}.min.css'.format(self.version)
|
||||
html_files = ['index.html', 'archives.html',
|
||||
'this-is-an-article-with-category.html']
|
||||
for f in html_files:
|
||||
self.check_link_tag(css_file, os.path.join(self.temp_path, f))
|
||||
|
||||
self.check_link_tag(
|
||||
'.././theme/gen/style.{0}.min.css'.format(self.version),
|
||||
os.path.join(self.temp_path, 'category/misc.html'))
|
||||
|
||||
def test_absolute_url(self):
|
||||
"""Look in the output index.html file for the link tag with abs url."""
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
{% block head %}
|
||||
{% assets filters="scss,cssmin", output="gen/style.%(version)s.min.css", "css/style.scss" %}
|
||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||
<link rel="stylesheet" href="{{ SITEURL }}/{{ ASSET_URL }}">
|
||||
{% endassets %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue