Adding Static Assets

This documentation is for Dash Enterprise,
Plotly’s commercial platform for managing and improving
Dash applications in your organization.
View the docs or
request a trial.


Adding Your Own CSS and JavaScript to Dash Apps

Including custom CSS or JavaScript in your Dash apps is simple. Just
create a folder named assets in the root of your app directory and include
your CSS and JavaScript files in that folder. Dash will automatically
serve all of the files that are included in this folder.

For more information about custom CSS, JavaScripts, HTML index template,
meta tags, or serving Dash’s component libaries locally, see
Dash Docs.


Embedding Images in Your Dash Apps

Apps deployed on Dash Enterprise are deployed under an app name
prefix. As a consequence, images that are added to the assets folder will
require the app name prefix in the relative path. For example, with the
below folder structure:

-- app.py
-- assets/
   |-- my-image.png

 

your app.py file you would include:

html.Img(src=app.get_asset_url('my-image.png'))