How do I use Dash to add local css?

Although this is currently not officially supported I found a hack:

First add your css to the dash core componets site-packages folder, mine is here:

C:\Users\Username\Anaconda3\Lib\site-packages\dash_core_components\mycss.css

Then in your app.py:

import dash_core_components as dcc
dcc._css_dist[0]['relative_package_path'].append('mycss.css')

I hope that in the future you can have your css in a static folder in the root directory of the server!

3 Likes