mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #484 from saimn/webassets_doc
Webassets documentation
This commit is contained in:
commit
ffe4bf0b71
1 changed files with 22 additions and 7 deletions
|
|
@ -468,7 +468,7 @@ template tag, for example:
|
||||||
.. code-block:: jinja
|
.. code-block:: jinja
|
||||||
|
|
||||||
{% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %}
|
{% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %}
|
||||||
<link rel="stylesheet" href="{{ ASSETS_URL }}">
|
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||||
{% endassets %}
|
{% endassets %}
|
||||||
|
|
||||||
will produce a minified css file with the version identifier:
|
will produce a minified css file with the version identifier:
|
||||||
|
|
@ -477,6 +477,15 @@ will produce a minified css file with the version identifier:
|
||||||
|
|
||||||
<link href="http://{SITEURL}/theme/css/style.min.css?b3a7c807" rel="stylesheet">
|
<link href="http://{SITEURL}/theme/css/style.min.css?b3a7c807" rel="stylesheet">
|
||||||
|
|
||||||
|
The filters can be combined, for example to use the `sass` compiler and minify
|
||||||
|
the output::
|
||||||
|
|
||||||
|
.. code-block:: jinja
|
||||||
|
|
||||||
|
{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %}
|
||||||
|
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||||
|
{% endassets %}
|
||||||
|
|
||||||
Another example for javascript:
|
Another example for javascript:
|
||||||
|
|
||||||
.. code-block:: jinja
|
.. code-block:: jinja
|
||||||
|
|
@ -491,6 +500,12 @@ will produce a minified and gzipped js file:
|
||||||
|
|
||||||
<script src="http://{SITEURL}/theme/js/packed.js?00703b9d"></script>
|
<script src="http://{SITEURL}/theme/js/packed.js?00703b9d"></script>
|
||||||
|
|
||||||
|
Pelican's debug mode is propagated to webassets to disable asset packaging,
|
||||||
|
and instead work with the uncompressed assets. However, this also means that
|
||||||
|
the `less` and `sass` files are not compiled, this should be fixed in a future
|
||||||
|
version of webassets (cf. the related `bug report
|
||||||
|
<https://github.com/getpelican/pelican/issues/481>`_).
|
||||||
|
|
||||||
.. _webassets: https://github.com/miracle2k/webassets
|
.. _webassets: https://github.com/miracle2k/webassets
|
||||||
.. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html
|
.. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue