I created a custom, react based plotly dash component, using the cookiecutter template:
https://dash.plotly.com/plugins
It states that
When you create your Python package, by default any non-Python files
won’t be included in the actual package. To include these files in the
package, you must list them explicitly in MANIFEST.in. That is,
MANIFEST.in needs to contain each JavaScript, JSON, and CSS file that
you have included in your my_dash_component/ folder
I included a file stylesheet.css
in my_dash_component/ folder and also specified it in MANIFEST.in
include my_dash_component/stylesheet.css
Furthermore, in the readme file of the generated example it states:
Add custom styles to your component by putting your custom CSS files
into your distribution folder (my_dash_component
).- Make sure that
they are referenced inMANIFEST.in
so that they get properly
included when you’re ready to publish your component.
- Make sure the stylesheets are added to the
_css_dist
dict inmy_dash_component/__init__.py
so dash will serve them automatically
when the component suite is requested
I tried:
_css_dist = [
{
'relative_package_path': 'stylesheet.css',
'namespace': package_name,
},
]
If I run usage.py, the stylesheet ist correctly considered.
However, if I install my component as a python package and use it in my main application, the stylesheet of the component is not considered.
Do I need to somehow explicitly reference the stylesheet from my main application?
Or should it be automatically included when using a custom component?
(I would prefer a worfklow where I include my stylesheet in an “asseets” folder of my component library and where that file would then automatically be packaged and served when using the component.).