Wagtail Dependencies
====================
This package for Wagtail makes it easy to manage front-end dependencies for admin plugins.
#### The problem
Multiple Wagtail plugins may require the same front-end dependency, ex. Font Awesome. But we don't want to require that dependency twice on the admin screen, so we need to detect that duplication and only include it only once.
#### The solution
We can use named dependencies to prevent duplication, as long as developers can agree to use the same name. For instance, if we name Font Awesome `fontawesome`, then multiple projects can enqueue the `fontawesome` CSS, and this app will be sure it's only imported once.
Usage
-----
Add `wagtaildependencies` to your `INSTALLED_APPS`, then you can use the following hooks:
* `enqueue_scripts`
* `enqueue_styles`
The system will automatically detect duplicates among enqueued media throughout apps and will only include the library once.
Example
-------
```python
@hooks.register('enqueue_scripts')
def enqueue_jquery():
return {
'jquery': {
'source': 'lib/js/jquery.js',
'version' '3.1.0',
}
}
@hooks.register('enqueue_styles')
def enqueue_fontawesome():
return {
'fontawesome': {
'source': 'lib/css/fontawesome.css',
'version': '4.6.3',
}
}
```
====================
This package for Wagtail makes it easy to manage front-end dependencies for admin plugins.
#### The problem
Multiple Wagtail plugins may require the same front-end dependency, ex. Font Awesome. But we don't want to require that dependency twice on the admin screen, so we need to detect that duplication and only include it only once.
#### The solution
We can use named dependencies to prevent duplication, as long as developers can agree to use the same name. For instance, if we name Font Awesome `fontawesome`, then multiple projects can enqueue the `fontawesome` CSS, and this app will be sure it's only imported once.
Usage
-----
Add `wagtaildependencies` to your `INSTALLED_APPS`, then you can use the following hooks:
* `enqueue_scripts`
* `enqueue_styles`
The system will automatically detect duplicates among enqueued media throughout apps and will only include the library once.
Example
-------
```python
@hooks.register('enqueue_scripts')
def enqueue_jquery():
return {
'jquery': {
'source': 'lib/js/jquery.js',
'version' '3.1.0',
}
}
@hooks.register('enqueue_styles')
def enqueue_fontawesome():
return {
'fontawesome': {
'source': 'lib/css/fontawesome.css',
'version': '4.6.3',
}
}
```
Metadata
Release files for wagtaildependencies 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtaildependencies-0.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / wagtaildependencies-0.0.0-py2.py3-none-any.whl
| Download URL | wagtaildependencies-0.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1efecdadc075e9bf42ae01add75df237c2710b49dd48b4cc1ba074d887d28c09
|
|
BLAKE2b-256 checksum How to use checksums |
75c926fc9560353b119e73def293225b9c5c6d94f5f9a91812168b0dee826969
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |