jonathan-s / django-sockpuppet

Build reactive applications with the django tooling you already know and love.
https://github.com/jonathan-s/django-sockpuppet
MIT License
450 stars 22 forks source link

Build Tools General Discussion #64

Closed DamnedScholar closed 3 years ago

DamnedScholar commented 3 years ago

I would like to have a non-directed conversation about the virtues and pitfalls of different front-end code organization strategies.

I currently use Webpack and know it well enough to suffice, but my fantasy is to move to Snowpack (when it's mature enough) for discretely bundling each controller with those dependencies that need to be tree-shaken, and use ES module syntax for importing Stimulus and each controller bundle. Cascading network calls kill your load time, but if you're only going two steps down for one or two files (index.html -> index.js -> controller-plus-deps.js), it's barely an issue. The worst part right now is having to remember to set up both Django and Webpack dev servers when I start work.

pirm-in commented 3 years ago

I am very much interested in this kind of architecture, and since I am working with Django a lot this project is quite interesting. I used to do more frontend work,that's where I come from basically, and I am used to use Javascript and npm heavily. but the time has come for me that I am looking for a different approach, that's why I am here. And I must admit that i won't consider using a solution which involves npm right now. I want to configure Django server. Include some Javascript libraries statically. That's it. Right now htmx is still one of my favorites for this reason, but I haven't found a good solution yet how to run some Javascript on an element inside a htmx-response. And I feel like stimulus is what I want there. I saw that Stimulus can be included without build step, so I might look into hotwire's turbo/stimulus again. But npm/webpack.. please no, thank you

nerdoc commented 3 years ago

Mee too. I am planning/building a rather bigger project, and as much as I dislike Javascript, I won't get around it there. django-sockpuppet is an almost perfect solution for me, but it lacks "helpers" for tooling and Js frontends. I tried to wrap my head around Snowpack and even Webpack and how to make it possible to use sockpuppet with it - but there is very few information for beginners on how to set up properly a working example project with e.g Snowpack (or Webpack) and sockpuppet. Yes, there its the docs, but for beginners this is not enough. What would be much of a help would be a complete, working example.

I think the way to go is "unbundlers" and modern Js, as well as web components.