✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Serve assets/ but don't load them automatically

After https://github.com/plotly/dash/pull/286, Dash uses the underneath Flask instance to serve and load files located in the assets/ directory, as it’s explained here: https://dash.plot.ly/external-resources

However, I have got some files (actually, javascript source files) that I want to decide dynamically if I want to load them or not (depending on the arguments given to my app) or that I want to load them discretionary later on from my source code (I use gdc.Import for this).

So, is there any way to keep serving those files from the assets/ folder but to do not load them with the application startup?

You can ignore certain files with a regex filter using app = dash.Dash(assets_ignore='.*ignored.*') which will ignore all files in your assets folder which contain the above pattern.

1 Like

But will the flask instance be still serving them?

This also seems to work: