-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Issue 481 - Support arbitrary file extensions in component suites #1078
Conversation
@Marc-Andre-Rivet Using his branch for my Dash installation (and re-running
When switching back to the released Dash When testing this branch, I expected everything to be loaded as before, except for my font files. Is it possible I need to modify my webpack config and |
Co-Authored-By: Ryan Patrick Kyle <rpkyle@users.noreply.github.com>
This PR is closer than I thought; I can load custom fonts. The CSS and JS files are being loaded too, but the CSS is not being applied as per #1078 (comment). That is, the rules are not being applied to the elements they select, even though the CSS files are there. |
@wbrgss Fixed some issues - can you give it another go?
|
@@ -505,7 +505,7 @@ def write_js_metadata(pkg_data, project_shortname, has_wildcards): | |||
for filename in filenames: | |||
extension = os.path.splitext(filename)[1] | |||
|
|||
if extension not in [".css", ".js", ".map"]: | |||
if extension in [".py", ".pyc", ".json"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pick up everything but the Python artifacts
dash_duo.wait_for_element("#btn").click() | ||
assert dash_duo.wait_for_element("#standard").text == "Standard" | ||
|
||
WebDriverWait(dash_duo.driver, 10).until( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better than dash.testing.wait.until
? It's barely any more complicated so fine to keep it, just curious if there's a difference.
Regardless, very nice test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't aware I could do that. I thought it was either this of dash_duo._wait_for
, will keep in mind for the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
Closes #481
Add arbitrary file support for component suite.
This is being done with the idea of packaging fonts with the components that require them without the need for adding assets or loading everything upfront as base64 inside css files. Images would be handled similarly, also with the
file-loader
.Once added, component repos using webpack can use the following loader configuration:
And include source resources in css files like so:
url(./My-Font.ttf)
will be resolved to the correct path by the same plugin used for async (https://github.com/plotly/dash/tree/dev/%40plotly/webpack-dash-dynamic-import)And include the resource in the component's
__init__.py
(and MANIFEST):Adding
dynamic:True
will ensure that the file is only loaded when requested by the css (e.g. async scenarios).Do note that as implemented, these resources will not be fingerprinted and will default to using
eTag
for caching purposes.