Repository navigation
Plugin static files - #7763
Plugin static files#7763
Conversation
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7763 +/- ##
==========================================
- Coverage 83.52% 83.51% -0.02%
==========================================
Files 1114 1114
Lines 49355 49365 +10
Branches 1571 1571
==========================================
+ Hits 41225 41226 +1
- Misses 7734 7743 +9
Partials 396 396
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@wolflu05 so with these changes are you happy that existing plugin static files are honoured, and also the new approach? |
|
Sorry, but I don't understand your comment, could you please explain? With this PR, the old approach using the AppMixin has no effect anymore, as the plugins get not loaded for the traditional Django static file collection. They only get copied with your added collectplugins script. That way there are no duplicated static files at two paths anymore. And yes, I'm happy with that, as this is a clear, single and official path now for handeling static files. (Also automatic if issue 2 from my comment is fixed too) Additionally I have fixed the issue with the recursive deletion. |
|
@wolflu05 sorry, was not very good description. I mean, that the new approach allows for static file collection whether or not the plugin has "app" support. So, are we happy that this is sufficient and covers all cases? |
|
Thanks for clarifying, Yes, I'm happy with it. |
|
Ok, well thanks for the additional fixes and insights :) |
This PR fixes issue 1 and 4 from #7709 (comment)
This PR is marked as breaking to appear at the top of the changelog. Something like the following text should be added to the changelog for users to explain the change:
Previously if a plugin had the
AppMixinand contained astaticfolder, static files where collected as part ofinvoke staticlike a normal django app directly in thestaticfolder (e.g.my-plugin/static/test.jswas accessible by/static/test.js). Now plugin static files are collected from every plugin that contains amy-plugin/staticfolder (No need for theAppMixinanymore) in/static/plugins/<plugin-slug>/meaning thetest.jsin the static folder from the previous example is now accessible from/static/plugins/<plugin-slug>/test.js.The
{% plugin_static "test.js" %}template tag from{% load plugin_extras %}can be used to get the correct path for a static file provided by a plugin. It is also backported to 0.15.x (#7764) and acts as a proxy to the normalstatictag there.