Using these helper classes, you can define your bundles or even your complete environment in some external data source, rather than constructing them in code.
Will load an environment or a set of bundles from YAML files.
Load a list of Bundle instances defined in the YAML file.
Expects the following format:
bundle-name:
filters: sass,cssutils
output: cache/default.css
contents:
- css/jquery.ui.calendar.css
- css/jquery.ui.slider.css
another-bundle:
# ...
Bundles may reference each other:
js-all:
contents:
- jquery.js
- jquery-ui # This is a bundle reference
jquery-ui:
contents: jqueryui/*.js
Finally, you may also use nesting:
js-all:
contents:
- jquery.js
# This is a nested bundle
- contents: "*.coffee"
filters: coffeescript
Load an Environment instance defined in the YAML file.
Expects the following format:
directory: ../static
url: /media
debug: True
updater: timestamp
config:
compass_bin: /opt/compass
another_custom_config_value: foo
bundles:
# ...
All values, including directory and url are optional. The syntax for defining bundles is the same as for load_bundles().
Sample usage:
from webassets.loaders import YAMLLoader
loader = YAMLLoader('asset.yml')
env = loader.load_environment()
env['some-bundle'].urls()
Basically just a simple helper to import a Python file and retrieve the bundles defined there.
Load Bundle objects defined in the Python module.
Collects all bundles in the global namespace.
Load an Environment defined in the Python module.
Expects a global name environment to be defined.