Django and Webpack - External Packages (HTMX and Alpine.js) CSS Loaders and Webpack Optimization

  Рет қаралды 2,935

BugBytes

BugBytes

Күн бұрын

Пікірлер: 28
@abhishekupadhyay6938
@abhishekupadhyay6938 Жыл бұрын
Sir you are amazing. Your teaching style is very detailed & easy to understand. I have learned many new things from watching your videos. Thank you very much for sharing your knowledge.
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot for that nice comment, I'm glad the videos have helped!
@BenMcNelly
@BenMcNelly 2 жыл бұрын
Timely episode, thanks!
@bugbytes3923
@bugbytes3923 2 жыл бұрын
You’re welcome, hope it is useful!
@robhafemeister3100
@robhafemeister3100 2 жыл бұрын
Great video and perfect timing.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Cheers Rob, hope it was useful!
@robhafemeister3100
@robhafemeister3100 2 жыл бұрын
@@bugbytes3923 Very useful, what would be the best way to add tailwind to webpack?
@robhafemeister3100
@robhafemeister3100 2 жыл бұрын
Currently I run npx tailwindcss -i ./src/tailwind.css -o ./assets/styles/styles.css --watch in another tab and then add styles.css to the assets/styles/index.css
@bugbytes3923
@bugbytes3923 2 жыл бұрын
@@robhafemeister3100 I'm planning a dedicated video on this topic - setting up Tailwind, along with HTMX and Alpine, for a modern "low-JS" application, with Webpack. Should be in a few weeks hopefully!
@robhafemeister3100
@robhafemeister3100 2 жыл бұрын
@@bugbytes3923 That sounds great!
@repotranstech
@repotranstech 2 жыл бұрын
Very helpful 👍 as always.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks!
@jaradc2198
@jaradc2198 Жыл бұрын
If I were to put the before the closing tag instead of in the , do you recommend to keep it in the head tag or.. doesn't matter? I'm wondering about the use of 'defer' when the script tag is in the head as well?
@Schlumpfpirat
@Schlumpfpirat 2 жыл бұрын
Love it! Can you make a video explaining how django-compressor integrates into all of this?
@codevision8491
@codevision8491 2 жыл бұрын
Great sir😘
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Cheers!
@ermalgashimramori
@ermalgashimramori 2 жыл бұрын
Thank you!
@daverobb2011
@daverobb2011 2 жыл бұрын
Fantastic as always. I'm getting one Alpine warning in my dev tools that alpine is trying to load before the body is available. It suggests that I add defer to the script tag. Is there a reason why you did not use the defer tag in the script block?
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks David! That is an oversight on my part. It's best for performance if you defer the script - and Alpine mention it in their installation docs: alpinejs.dev/essentials/installation
@skyhappy
@skyhappy 2 жыл бұрын
You should check out vite, I use it over webpack since it's faster according to some stats I saw. Built on top of the fastest bundler, esbuild.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks for the tip, I'll look into it!
@nicenaija9952
@nicenaija9952 2 жыл бұрын
Will this work with tailwindcss?
@bugbytes3923
@bugbytes3923 2 жыл бұрын
There's some specific setup for Tailwind. I'll be demo'ing this in a future short video - the concepts are very similar though.
@tobidegnon4409
@tobidegnon4409 2 жыл бұрын
Have you tried any other js bundler outside of webpack? Something like parcel for exemple. In the js ecosystem webpack is reputed to be the most complex one and since as django devs we would like to avoid the most js complication as possible, I was wondering if something even simpler exists for our use case. But frankly your explanation are quite good and don't make this stuff seam's that complicated
@bugbytes3923
@bugbytes3923 2 жыл бұрын
I've heard of Parcel and Rollup, but haven't really used them much yet. I'd like to try 'em out though. I think Webpack's still the main one, and it's the one I've used most. Webpack definitely is more complicated than it could be though. Might give the others a go in a future project!
@AmoahDevLabs
@AmoahDevLabs 2 жыл бұрын
Very great tutorial. Any I'm getting an error in my terminal. It seems webpack is traversing through django/contrib/gis/ directory and throwing an error. This is the error "ERROR in /run/media/natus/alpha/Dev/Django/webpack/venv/lib/python3.10/site-packages/django/contrib/gis/templates/gis/admin/osm.js 2:86-87 [tsl] ERROR in /run/media/natus/alpha/Dev/Django/webpack/venv/lib/python3.10/site-packages/django/contrib/gis/templates/gis/admin/osm.js(2,87) TS1109: Expression expected. 377 errors have detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it." Please check this out.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thank you. Hard to tell exactly, but it looks like a TypeScript error. Are you using the "ts-loader"? When you define the "ts-loader", you should exclude all files from the Django project I think. More on excluding files here: webpack.js.org/guides/typescript/#basic-setup
Marimo Notebooks Intro | Charting Python's rise in popularity
18:15
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
The Right Way to Handle Number Formatting in Next
7:44
Oh My Function
Рет қаралды 79
django-slippers and DRY Django Templates
15:26
BugBytes
Рет қаралды 7 М.
Don't be THAT backend engineer, EVER
59:17
K Srinivas Rao
Рет қаралды 3,9 М.
Life is easy with Solid JS, Tailwind and PocketBase
11:01
Awesome
Рет қаралды 24 М.
Django and htmx Tutorial: Easier Web Development
1:05:52
PyCharm, a JetBrains IDE
Рет қаралды 19 М.
Django + Vite: The simple way
30:20
Luciano Ratamero
Рет қаралды 20 М.
django-htmx - Django Extensions for Working with HTMX
37:06
BugBytes
Рет қаралды 24 М.
Alpine.js Crash Course
42:02
Traversy Media
Рет қаралды 130 М.
Django and HTMX #10 - Chained Dropdowns with Django and HTMX
12:27
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН