Hi David. 

Wowser. Good work! 

(A cup of tea indeed — I should have replied to the first question better 
😝)

(Inter alia) You raised five questions. These were the last three: 

- Should there be better support for front end JS frameworks
- Should we have support for webpack
- We should support NPM

I think the *key point here is not to bind to a particular package*, 
webpack say. It's already Parcel.js no? — and it'll be something else next 
week. 🙂

django-compressor, beyond concatenating and compressing files has this neat 
ability to define `COMPRESS_PRECOMPILERS` 
<https://django-compressor.readthedocs.io/en/stable/settings/#django.conf.settings.COMPRESS_PRECOMPILERS>

Here you can map files to any CLI tool (or write a bit of Python if it gets 
too clever — but TBH I never have to do that). 

An example from a project: 

COMPRESS_PRECOMPILERS = (
    ("text/x-tailwind", TAILWIND_COMMAND),     # Compile tailwind via 
PostCSS, with tree-shaking, FTW 💃
    # ("text/x-scss", SASS_COMMAND),              # Would compile Sass. 
Oops didn't delete it yet. 
    ("text/x-elm", ELM_MAKE_COMMAND),        # Run elm make.
)

You can just as easily put in webpack or parcel or babel (or a chain of any 
or all of them...) 

It's that plus the offline compress tool that means I've been happy with 
compressor for a long time — I just never had to move on. 
(There's a point where you hand off to a frontend specialist but ...) 

So, particularly given how fast the tools landscape moves here, and how 
slow Django moves in comparison, some kind of wrapper where you shell out 
to A.N.Tool — it doesn't have to be JavaScript. It might be make, or 
pyinvoke — rather than something tied to webpack, as the example, would be 
a requirement for me. 


*Not sure* how much of this we need to pull into Django itself? compressor, 
say, does the whole combine and compress thing well. If we pull that in are 
we going to do the same for image optimization? Or pull in Whitenoise? 
Or...? For a user just with contib.staticfiles, what's the very next thing 
we could do that would make life easier? (i.e. is "I can't run webpack" top 
of their list?) — What can we do better in core vs a third-party app? — Is 
that just awareness, which is not a nothing? 
Note the "not sure" — I think about this a lot, it's a big issue, but I 
don't have a single answer: I've got what I do, and that works for me, but 
I see lots of people doing different with success. 

Kind Regards,

Carlton



-- 
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/4cda64f0-2630-4377-a2d7-a2312a006ae9%40googlegroups.com.
  • ... David Smith
    • ... Carlton Gibson
      • ... Claude Paroz
    • ... Aymeric Augustin
      • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
      • ... David Smith
        • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)

Reply via email to