Serve assets/ but don't load them automatically

After, Dash uses the underneath Flask instance to serve and load files located in the assets/ directory, as it’s explained here: Adding CSS & JS and Overriding the Page-Load Template | Dash for Python Documentation | Plotly

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: