github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/214#issuecomment-382048582 | https://api.github.com/repos/simonw/datasette/issues/214 | 382048582 | MDEyOklzc3VlQ29tbWVudDM4MjA0ODU4Mg== | 9599 | 2018-04-17T16:04:42Z | 2018-04-18T02:24:46Z | OWNER | One possible option: let plugins bundle their own `static/` directory and then register themselves with Datasette, then have `/-/static-plugins/name-of-plugin/...` serve files from that directory. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314506446 | |
https://github.com/simonw/datasette/issues/214#issuecomment-382069980 | https://api.github.com/repos/simonw/datasette/issues/214 | 382069980 | MDEyOklzc3VlQ29tbWVudDM4MjA2OTk4MA== | 9599 | 2018-04-17T17:08:28Z | 2018-04-17T17:08:28Z | OWNER | Even if we automatically serve ALL `static/` content from installed plugins, we'll still need them to register which files need to be linked to from `extra_css_urls` and `extra_js_urls` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314506446 | |
https://github.com/simonw/datasette/issues/214#issuecomment-382038613 | https://api.github.com/repos/simonw/datasette/issues/214 | 382038613 | MDEyOklzc3VlQ29tbWVudDM4MjAzODYxMw== | 9599 | 2018-04-17T15:38:23Z | 2018-04-17T15:38:23Z | OWNER | I figured out the recipe for bundling static assets in a plugin: https://github.com/simonw/datasette-plugin-demos/commit/26c5548f4ab7c6cc6d398df17767950be50d0edf (and then `python3 setup.py bdist_wheel`) Having done that, I ran `pip install ../datasette-plugin-demos/dist/datasette_plugin_demos-0.2-py3-none-any.whl` from my Datasette virtual environment and then did the following: ``` >>> import pkg_resources >>> pkg_resources.resource_stream( ... 'datasette_plugin_demos', 'static/plugin.js' ... ).read() b"alert('hello');\n" >>> pkg_resources.resource_filename( ... 'datasette_plugin_demos', 'static/plugin.js' ... ) '..../venv/lib/python3.6/site-packages/datasette_plugin_demos/static/plugin.js' >>> pkg_resources.resource_string( ... 'datasette_plugin_demos', 'static/plugin.js' ... ) b"alert('hello');\n" ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314506446 |