Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset serving #46

Closed
nicolaskruchten opened this issue Nov 26, 2018 · 2 comments · Fixed by #64
Closed

Asset serving #46

nicolaskruchten opened this issue Nov 26, 2018 · 2 comments · Fixed by #64
Assignees

Comments

@nicolaskruchten
Copy link
Member

There's a surprisingly deep and complicated pipeline behind the generation of the component <script> tags that Dash drops into the index.html which it returns to clients on first load.

Minimally, DashR needs to serve script tags for locally served JS bundles that match the component libraries that are loaded in the initial layout.

This is on the critical path for #45

@nicolaskruchten
Copy link
Member Author

image

@rpkyle
Copy link
Contributor

rpkyle commented Mar 11, 2019

Minimally, DashR needs to serve script tags for locally served JS bundles that match the component libraries that are loaded in the initial layout.

This is currently working. However, since this is minimal, but not sufficient, I'm filling in a few more details here.

Here's the list of features that must be available for the initial release:

  • Assets folder auto resolution (/assets) at the root of the project by default.
  • Assert that assets folder may be passed as parameter
  • Assert that JS/CSS files in /assets are served in the index
  • Assert that an ignore filter exists and works for served assets
  • Assert that assets are cached by the browser, and uncached when modified
  • Assert that all files in /assets are served statically
  • Assert that the assets URL respects routes/requests pathname prefix
  • Assert that easy retrieval of assets URLs is possible: get_asset_url(asset) should return a ready-to-insert URL string
  • Assert that if a favicon.ico is found in the assets folder, it be served as the title icon of the page.

The order of operations:

  1. Just prior to serving the index, walk assets directory, if present, and use ressource_route (sic) function to supply static routes to local resources.
  2. Ensure that the static handler supplied by routr handles caching and MIME typing properly.
  3. Check out the current Python test app, and implement something similar in R, since there's a logical ordering to asset serving.

See also:
https://github.com/plotly/dash/blob/master/tests/test_resources.py
https://github.com/plotly/dash/blob/1de85b387ae56f19d70b1c148953dce6ddb0ecfc/dash/dash.py#L1107-L1170

@T4rk1n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants