Allow Inlining of Asset Contents#384
Conversation
There was a problem hiding this comment.
That amazing work, thanks a bunch for putting in the time. Unfortunately, I think we have a problem here that is possibly complex, which is that before this patch, you could set auto_build to False, and the correct urls could be generated without the filesystem being touched; indeed, the actual files needn't be available. That's incredibly useful for when your static files are on S3 or the like, or if you just want to avoid the performance hit.
Of course, if ASSETS_CONTENT is used, that is no longer possible. We can also ignore the question whether webassets should cache the content in memory for now; but the problem is that right now, by always using urls_with_content in the template tag, unless I am mistaken, you are essentially forcing a file read in all cases.
Ideally, the tag could detect the presence of ASSETS_CONTENT itself. I'm not sure if that is possible.
|
Maybe it is possible - there is an idea from another pull request: https://github.com/miracle2k/django-assets/pull/25/files Another solution might be to use a smart object that has a |
Fixes #246. This adds a
urls_with_bodiesmethod that is complementary to the existingurlsmethod. It updates the Jinja extension to add anASSET_CONTENTSvariable. Tests are passing.