For those who want more information on getting Django to serve your
frontend assets, Aymeric wrote some good react-focussed blog posts:
https://fractalideas.com/blog/making-react-and-django-play-well-together-hybrid-app-model/

On Tue, 22 Dec 2020 at 12:43, Adam Johnson <m...@adamj.eu> wrote:

>
>
> Additionally, I also propose that  the HTMl files served by wsgi.py are
>> minified.
>>
>
> This can already be done with e.g.
> https://htmlmin.readthedocs.io/en/latest/reference.html#wsgi-middlware .
> But normally HTML minification isn't particularly worth it since
> gzip/brotli can compress it well already.
>
> On Tue, 22 Dec 2020 at 11:58, Diptesh Choudhuri <
> diptesh.choudh...@gmail.com> wrote:
>
>> Correct. Also having to use third party packages (and even other
>> languages!) for something so common and so useful feels incorrect somehow.
>>
>> Additionally, I also propose that  the HTMl files served by wsgi.py are
>> minified. This will be significantly more difficult to achieve since HTML
>> pages are served on the fly. But I think the benefits would surely outweigh
>> the maintenance costs these features bring.
>>
>> On Tuesday, December 22, 2020 at 5:03:23 PM UTC+5:30 arvind...@gmail.com
>> wrote:
>>
>>> I didn't mean we should include things in Django. Even a workflow that
>>> integrates with Django using manage.py commands will be super useful.
>>>
>>> Right now, I use Parcel + Tailwind (csspostprocessor mostly) + done
>>> JavaScript. It's supposed to be simple.
>>>
>>> Even for this, I need to run to terminals (one for Django, one for the
>>> frontend) or use something like Honcho with a procfile just so I can
>>> develop in peace. Or I should hack gulp to run Django runserver for me.
>>>
>>> This is not documented anywhere officially but is a very very common
>>> workflow even for small applications.
>>>
>>> I'm saying we do something to make this an easier process.
>>>
>>> Get Outlook for Android <https://aka.ms/ghei36>
>>>
>>> ------------------------------
>>> *From:* django-d...@googlegroups.com <django-d...@googlegroups.com> on
>>> behalf of Dmitriy Sintsov <quest...@gmail.com>
>>> *Sent:* Tuesday, December 22, 2020 3:59:15 PM
>>> *To:* django-d...@googlegroups.com <django-d...@googlegroups.com>
>>> *Subject:* Re: collectstatic command should output minified files
>>>
>>> There is one trouble: Webpack assumes it's own subtree of assets to
>>> process, while Django loads assets from packages (Django apps) directories.
>>> I still haven't seen a successful setup of webpack which would respect
>>> loading assets from Django packages directories.
>>> Another trouble, not everyone wants to carry node.js subsystem with it's
>>> huge list of packages in their Python / Django project.
>>> But there are changes that transpiling would not be required in the
>>> future at all, after IE11 would fade to the past:
>>>
>>> https://www.freecodecamp.org/news/you-might-not-need-to-transpile-your-javascript-4d5e0a438ca/
>>>
>>> On Tue, Dec 22, 2020 at 1:20 PM Adam Johnson <m...@adamj.eu> wrote:
>>>
>>> django-compressor is also popular:
>>> https://pypi.org/project/django-compressor/
>>>
>>> IMO we should not include anything in Django since JavaScript is a
>>> separate language, and they have much better tools for minification and
>>> bundling, and these tools can move faster than and orthogonally to Django.
>>> And there are many options: Webpack, Parcel, Gulp, Grunt, Rollup, ..
>>>
>>> On Tue, 22 Dec 2020 at 10:06, quest...@gmail.com <quest...@gmail.com>
>>> wrote:
>>>
>>> There is CSS / Javascript merge and compress package for Python:
>>> https://github.com/miracle2k/webassets
>>> which supports Django, Flask, Pyramid.
>>>
>>> See also:
>>>
>>> https://www.slideshare.net/__amol__/pyconit7-dukpy-webassets-free-yourself-from-nodejs-chains
>>> https://pypi.org/project/dukpy/
>>> https://gist.github.com/amol-/0fd016bbb0c6c9a0fb6ab5bbedfcb7ad
>>> https://github.com/rclmenezes/webassets-rollup
>>>
>>>
>>> On Tuesday, December 22, 2020 at 5:03:54 AM UTC+3 arvind...@gmail.com
>>> wrote:
>>>
>>> I kinda like the idea of being able to run collectstatic and not have to
>>> worry about setting up a full on frontend workflow for pretty much just
>>> minification. It is a great default to have when this is all you need.
>>>
>>> That said, I’d be more interested in seeing something like an official
>>> or a django-blessed unofficial default option similar to the
>>> sprokects-rails gem for ruby. Allowing for a much more flexible and
>>> extensive frontend pipeline without having to rely on an external task
>>> runner.
>>>
>>> On 22 Dec 2020, at 7:24, Diptesh Choudhuri wrote:
>>>
>>> The default files copied to STATIC_ROOT when you run python manage.py
>>> collectstatic should have two versions- file.js and file.min.js (similarly
>>> for css files). As far as I can see, this happens only for the preinstalled
>>> apps (like admin/actions.min.js) but not for user installed apps.
>>> Serbing minified static files is important for all production
>>> environments for pretty much everyone who uses vanilla django. Though there
>>> are packages out there to do this, I feel it is important enough and has
>>> enough use cases to be added to the django core.
>>>
>>> I can start working on this if it is accepted.
>>> Let me know what you think!
>>>
>>> Best
>>> Diptesh Choudhuri
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-develop...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/5bcb1522-3486-452e-b061-2cce2bb6d2c9n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-developers/5bcb1522-3486-452e-b061-2cce2bb6d2c9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-develop...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/b4ee304c-6861-417c-a20c-bf79b5e2d9efn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-developers/b4ee304c-6861-417c-a20c-bf79b5e2d9efn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>>
>>> --
>>> Adam
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-developers/dZDRivF29po/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-develop...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/CAMyDDM2xcYM9M1AB-ZK47V4JHH0mNoYvXntz8-wrbzxdOJ1QFg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-developers/CAMyDDM2xcYM9M1AB-ZK47V4JHH0mNoYvXntz8-wrbzxdOJ1QFg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-develop...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/CAC5UD1xbCfqv-sLs1p%3D%2BgnVp8k454VtOwP80qAw3H1y7WBUuWw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-developers/CAC5UD1xbCfqv-sLs1p%3D%2BgnVp8k454VtOwP80qAw3H1y7WBUuWw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/5e56ab9e-6343-4731-918f-697ad438f532n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-developers/5e56ab9e-6343-4731-918f-697ad438f532n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Adam
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM2rAiYC2_xftJJVLALe6rDykCRLOuzUm%2B7gtdHHJDtHrA%40mail.gmail.com.

Reply via email to