[ckan-dev] How can I use underscorejs in javascript module

Sean Hammond sean.hammond at okfn.org
Mon Jun 2 10:53:19 UTC 2014


> 
> You can add dependencies using fanstatic. For example, check
> https://github.com/ckan/ckanext-basiccharts/blob/master/ckanext/basiccharts/theme/public/resource.config
> . That resource.config file configures the JS and CSS dependencies used in
> the extension. To make CKAN know you've created it, you need to call
> ckan.plugins.toolkit.add_resource() in your extension (as in
> https://github.com/ckan/ckanext-basiccharts/blob/master/ckanext/basiccharts/plugin.py#L21-L23),
> and then you can add that to any template you'd like, as in
> https://github.com/ckan/ckanext-basiccharts/blob/master/ckanext/basiccharts/theme/templates/basechart_view.html#L1

The docs for this could be better:

http://docs.ckan.org/en/latest/theming/fanstatic.html

There's a note at the bottom of that page that mentions dependencies
between files and links to this page:

http://docs.ckan.org/en/latest/contributing/frontend/resources.html

which does explain about the resource.config file, but I think that
whole second page could be refactroed and inlined into the first
(fanstatic.html) page, with a clearer explanation and an example.



More information about the ckan-dev mailing list