You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,9 @@
14
14
Django Lazy srcset
15
15
==================
16
16
17
-
Lazy srcset and image generation for Django. Minimum effort required. No database required.
17
+
Lazy srcset and responsive image generation for Django. Minimum effort required. No database required.
18
18
19
-
Django Lazy srcset will create all the markup and images you need to provide responsive images via the srcset attribute. All you need to do is install it, configure your breakpoints and use the ``{% srcset %}`` template tag.
19
+
Django Lazy srcset will create the markup and generate the images you need to provide responsive images via the `srcset and sizes attributes for the img tag <https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images#resolution_switching_different_sizes>`_. All you need to do is install it, configure your breakpoints and use the ``{% srcset %}`` template tag.
20
20
21
21
All of the hard work (image generation and cacheing) is done by django-imagekit, by default this means images are generated just in time - lazily. Please see the `django-imagekit docs <https://django-imagekit.readthedocs.io>`_ for more info and configuration options.
22
22
@@ -44,7 +44,7 @@ Add ``"imagekit"`` and ``"lazy_srcset"`` to ``INSTALLED_APPS``:
44
44
# ...
45
45
]
46
46
47
-
Configure your breakpoints and stuff:
47
+
Configure your breakpoints and stuff (most/all of this is optional):
48
48
49
49
.. code-block:: python
50
50
@@ -93,14 +93,32 @@ Use the ``{% srcset %}`` template tag:
93
93
94
94
Whilst not required it is advisable to take a nap at this stage.
95
95
96
-
For further documentation and examples of all the options please read the docstrings in the source code for `lazy_srcset/templatetags/lazy_srcset.py <https://github.com/Quantra/django-lazy-srcset/blob/master/lazy_srcset/templatetags/lazy_srcset.py>`_.
96
+
For further documentation and examples of all the options please see the huge and obvious docstring in the source code for `lazy_srcset/templatetags/lazy_srcset.py <https://github.com/Quantra/django-lazy-srcset/blob/master/lazy_srcset/templatetags/lazy_srcset.py>`_.
97
97
98
-
Due to the awesomeness of imagekit it's possible to configure django-lazy-srcset to use any image generator you have registered on a per config basis. Take a look at `lazy_srcset/conf.py <https://github.com/Quantra/django-lazy-srcset/blob/master/lazy_srcset/conf.py>`_ to see how to change the ``generator_id`` setting. For an example image generator look at `lazy_srcset/imagegenerators.py <https://github.com/Quantra/django-lazy-srcset/blob/master/lazy_srcset/imagegenerators.py>`_. This is completely optional but I thought I'd mention it as there are potential artistic uses here; for example you could use a generator to add filters to images.
98
+
Advanced
99
+
--------
100
+
101
+
Due to the awesomeness of django-imagekit it's possible to configure django-lazy-srcset to use any image generator you have registered on a per config basis. Take a look at `lazy_srcset/conf.py <https://github.com/Quantra/django-lazy-srcset/blob/master/lazy_srcset/conf.py>`_ to see how to change the ``generator_id`` setting. For an example image generator look at `lazy_srcset/imagegenerators.py <https://github.com/Quantra/django-lazy-srcset/blob/master/lazy_srcset/imagegenerators.py>`_. This is completely optional but I thought I'd mention it as there are potential artistic uses here; for example you could use a generator to add filters to some images.
99
102
100
103
Currently imagekit ``SourceGroup`` has not been implemented therefore the imagekit ``generateimages`` management command will not generate images for django-lazy-srcset. If you want to pre-generate images you can ``render_to_string()`` your templates in an appropriate save method or signal. If you are using `django-content-blocks <https://github.com/Quantra/django-content-blocks>`_ this happens on publish anyway.
101
104
102
105
Clean up of old, unused files created by django-lazy-srcset is down to you, if you require it at all.
103
106
107
+
Development Status & Roadmap
108
+
----------------------------
109
+
110
+
Django lazy srcset is in beta. There are currently no plans for further development.
0 commit comments