mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Minor doc changes, including those for webassets
This commit is contained in:
parent
ac67587b79
commit
007cd9b8fd
2 changed files with 34 additions and 34 deletions
|
|
@ -277,13 +277,12 @@ For RestructuredText, use the code-block directive::
|
||||||
|
|
||||||
<indented code block goes here>
|
<indented code block goes here>
|
||||||
|
|
||||||
For Markdown, include the language identifier just above code blocks::
|
For Markdown, include the language identifier just above the code block,
|
||||||
|
indenting both the identifier and code::
|
||||||
|
|
||||||
:::identifier
|
:::identifier
|
||||||
<code goes here>
|
<code goes here>
|
||||||
|
|
||||||
(indent both the identifier and code)
|
|
||||||
|
|
||||||
The specified identifier (e.g. ``python``, ``ruby``) should be one that
|
The specified identifier (e.g. ``python``, ``ruby``) should be one that
|
||||||
appears on the `list of available lexers <http://pygments.org/docs/lexers/>`_.
|
appears on the `list of available lexers <http://pygments.org/docs/lexers/>`_.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -448,26 +448,27 @@ adding the following to your configuration::
|
||||||
Asset management
|
Asset management
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
The `WEBASSETS` setting allows to use the `webassets`_ module to manage assets
|
The `WEBASSETS` setting allows you to use the `webassets`_ module to manage
|
||||||
(css, js). The module must first be installed::
|
assets such as CSS and JS files. The module must first be installed::
|
||||||
|
|
||||||
pip install webassets
|
pip install webassets
|
||||||
|
|
||||||
`webassets` allows to concatenate your assets and to use almost all of the
|
The `webassets` module allows you to perform a number of useful asset management
|
||||||
hype tools of the moment (see the `documentation`_):
|
functions, including:
|
||||||
|
|
||||||
* css minifier (`cssmin`, `yuicompressor`, ...)
|
* CSS minifier (`cssmin`, `yuicompressor`, ...)
|
||||||
* css compiler (`less`, `sass`, ...)
|
* CSS compiler (`less`, `sass`, ...)
|
||||||
* js minifier (`uglifyjs`, `yuicompressor`, `closure`, ...)
|
* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...)
|
||||||
|
|
||||||
Others filters include gzip compression, integration of images in css with
|
Others filters include gzip compression, integration of images in CSS via data
|
||||||
`datauri` and more. Webassets also append a version identifier to your asset
|
URIs, and more. `webassets` can also append a version identifier to your asset
|
||||||
url to convince browsers to download new versions of your assets when you use
|
URL to convince browsers to download new versions of your assets when you use
|
||||||
far future expires headers.
|
far-future expires headers. Please refer to the `webassets documentation`_ for
|
||||||
|
more information.
|
||||||
|
|
||||||
When using it with Pelican, `webassets` is configured to process assets in the
|
When using with Pelican, `webassets` is configured to process assets in the
|
||||||
``OUTPUT_PATH/theme`` directory. You can use it in your templates with a
|
``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by
|
||||||
template tag, for example:
|
including one or more template tags. For example...
|
||||||
|
|
||||||
.. code-block:: jinja
|
.. code-block:: jinja
|
||||||
|
|
||||||
|
|
@ -475,22 +476,22 @@ template tag, for example:
|
||||||
<link rel="stylesheet" href="{{ ASSET_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 a version identifier:
|
||||||
|
|
||||||
.. code-block:: html
|
.. code-block:: html
|
||||||
|
|
||||||
<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
|
These filters can be combined. Here is an example that uses the SASS compiler
|
||||||
the output::
|
and minifies the output:
|
||||||
|
|
||||||
.. code-block:: jinja
|
.. code-block:: jinja
|
||||||
|
|
||||||
{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %}
|
{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %}
|
||||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||||
{% endassets %}
|
{% endassets %}
|
||||||
|
|
||||||
Another example for javascript:
|
Another example for Javascript:
|
||||||
|
|
||||||
.. code-block:: jinja
|
.. code-block:: jinja
|
||||||
|
|
||||||
|
|
@ -498,20 +499,20 @@ Another example for javascript:
|
||||||
<script src="{{ ASSETS_URL }}"></script>
|
<script src="{{ ASSETS_URL }}"></script>
|
||||||
{% endassets %}
|
{% endassets %}
|
||||||
|
|
||||||
will produce a minified and gzipped js file:
|
The above will produce a minified and gzipped JS file:
|
||||||
|
|
||||||
.. code-block:: html
|
.. code-block:: html
|
||||||
|
|
||||||
<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,
|
Pelican's debug mode is propagated to `webassets` to disable asset packaging
|
||||||
and instead work with the uncompressed assets. However, this also means that
|
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
|
the LESS and SASS files are not compiled. This should be fixed in a future
|
||||||
version of webassets (cf. the related `bug report
|
version of `webassets` (cf. the related `bug report
|
||||||
<https://github.com/getpelican/pelican/issues/481>`_).
|
<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
|
.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html
|
||||||
|
|
||||||
Example settings
|
Example settings
|
||||||
================
|
================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue