-
-
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 480 - Add .map file extension support to dash #478
Changes from 5 commits
6e8cbb7
d02047c
e9adb52
656e24d
481d15f
2f39135
191b34b
c4f4c49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,6 +352,7 @@ def serve_routes(self): | |
mimetype='application/json' | ||
) | ||
|
||
# pylint: disable=too-many-branches | ||
def _collect_and_register_resources(self, resources): | ||
# now needs the app context. | ||
# template in the necessary component suite JS bundles | ||
|
@@ -378,15 +379,25 @@ def _relative_url_path(relative_package_path='', namespace=''): | |
|
||
srcs = [] | ||
for resource in resources: | ||
is_dynamic_resource = 'dynamic' in resource and \ | ||
resource.get('dynamic') | ||
|
||
if 'relative_package_path' in resource: | ||
if isinstance(resource['relative_package_path'], str): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An alternate way might solve the too-many-branches 🐫
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure.. I'm in, if only because it makes me learn the language haha! |
||
srcs.append(_relative_url_path(**resource)) | ||
path = _relative_url_path( | ||
resource['relative_package_path'], | ||
resource['namespace'] | ||
) | ||
if not is_dynamic_resource: | ||
Marc-Andre-Rivet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
srcs.append(path) | ||
else: | ||
for rel_path in resource['relative_package_path']: | ||
srcs.append(_relative_url_path( | ||
path = _relative_url_path( | ||
relative_package_path=rel_path, | ||
namespace=resource['namespace'] | ||
)) | ||
) | ||
if not is_dynamic_resource: | ||
srcs.append(path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here.. |
||
elif 'external_url' in resource: | ||
if isinstance(resource['external_url'], str): | ||
srcs.append(resource['external_url']) | ||
|
@@ -492,7 +503,8 @@ def serve_component_suites(self, package_name, path_in_package_dist): | |
|
||
mimetype = ({ | ||
'js': 'application/JavaScript', | ||
'css': 'text/css' | ||
'css': 'text/css', | ||
'map': 'application/json' | ||
Marc-Andre-Rivet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
})[path_in_package_dist.split('.')[-1]] | ||
Marc-Andre-Rivet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
headers = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ def _filter_resources(self, all_resources, dev_bundles=False): | |
filtered_resources = [] | ||
for s in all_resources: | ||
filtered_resource = {} | ||
if 'dynamic' in s: | ||
filtered_resource['dynamic'] = s['dynamic'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if 'namespace' in s: | ||
filtered_resource['namespace'] = s['namespace'] | ||
if 'external_url' in s and not self.config.serve_locally: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.31.1' | ||
__version__ = '0.31.2' |
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.
perhaps
resource.get('dynamic', False)
so it is not splitThere 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.
dictionary entry with default I guess?