Ticket #2439 (closed defect: fixed)
Support ToscaWidgets resource variants and other TW config options
| Reported by: | chrisz | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1rc1 |
| Component: | TurboGears | Version: | trunk |
| Severity: | normal | Keywords: | ToscaWidgets variants |
| Cc: |
Description
ToscaWidgets 0.9.8 supports "variants" for Javascript and CSS resources (minified, packed or debug versions of the js/css files).
TurboGears should configure this properly in a quickstarted app.
On the TurboGears mailing list, Diez suggested adding the following to config.middleware:
import tw.api
tw.api.resources.registry.ACTIVE_VARIANT = app_conf.get(
"tw.resource_variant", tw.api.resources.registry.DEFAULT_VARIANT)
Then, the templates for development.ini and deployment.ini should set tw.resource_variant to 'debug' and 'minified'/'packed' respectively.
Diez also suggested passing app_conf (self) to tw.api.make_middleware (tw_middleware) in the AppConfig.add_tosca_middleware() method of the tg.configuration module. Then ToscaWidgets could care for the configuration itself, and other config-options could be set as well, e.g. require_once, serve_resources and so on.
Change History
comment:2 Changed 3 years ago by percious
- Status changed from new to closed
- Resolution set to fixed
I added this as a config option in the "toscawidgets" section. This way you can even set it in your .ini file.
toscawidgets.framework.resource_variant = min in your ini to set to minified files, for instance.