- Podcasts
- CodingCat.dev Podcast
- Code with CodingCat.dev: SvelteKit with DaisyUI
Code with CodingCat.dev: SvelteKit with DaisyUI
CodingCat.dev Podcast
- June 30, 2024
- 1 h 34 min
- Episode 2
About this episodehttps://codingcat.dev/podcast/sveltekit-with-daisyui
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
Code with CodingCat.dev: SvelteKit with DaisyUI
Oh, hey, Brittany, I made. It. You're here already. I am here. We thought we would have to wait for Brittany today, but as it turns out. And I ran, so I'm sorry. Well, welcome Brittany, and welcome all you perfect peeps out there. How how are you doing today, Britt? Exhausted already, It's been a busy morning. It's been it's been a long week.
How is week 3 annalify? Four, we're on like Week 7. No way is it that right? Wow, it's been that long. Oh my gosh, time. Time is an enigma. Holy smokes. Well, that's awesome. It might be week six, I don't know. I can't keep track but maybe next week is week 7. I know you tell me all the time how amazing it is, but do you have any tidbits to the audience like, Oh my gosh, this happened that you can share? Oh, Oh my gosh, this happened.
Oh Lord, I don't know. But the culture there is so take. You out for waffles or anything? We do have a all hands coming up, so I'm kind of excited about that to finally meet some of the people that I've been working with. But Phil posted the other day one of the remotely interesting recordings of all of us laughing. Then that is literally how every meeting is. So that is probably the best part is that it's just us laughing 24/7.
That is awesome. I love, I love all the channels you keep telling me about in LFI, so that's pretty cool. Oh yeah, Slack is like a fun discord server. For sure. I feel like my lips are behind my speaking so I don't know what's happening with the camera. Oh, I don't know. I had to move you over here so I'm not even watching.
The video Oh, you got the second monitor hooked up today. I do. It's a terrible one. It's my like old one that hooked up to a Raspberry Pi. But it's fine for like this kind of stuff, so. Yeah. I wanted to bring up since you know, it's Friday and we should promote the heck out of each other, you have an amazing podcast slash not podcast guide and tutorial floating around. Which one I have?
Oh, yes, OK, so. This is pretty. Sweet, I have the how to deploy solid JS. Yeah I did that. I also did one on the acronyms of rendering and so I've got a couple floating out there right now. Fine. It should yeah, I should have my own little author page and I've got our stuff in there. If you didn't notice that perfect dev and coding cat dev is like mentioned up there in my bio IT. Is.
Yeah, they're not not linked out. I don't know, maybe I need to go and add the markdown links to that. But yeah, it's been just an amazing experience there. And I think I'm having Internet issues because I tried to send Nikki a message and it errored out on me, so maybe that's why I'm having some lag.
Man, OK, well, no big deal. Hey, Nikki. Nice. Hey friends. My computer opened three instances of Blender that could be causing some issues. Too. Yeah, Blender. Blender takes a few resources. Oh wow. Yeah, that was that was probably some of my problem. Maybe it'll catch up now. You know I haven't asked you this because I I still stink at it, but should I hang out on twitch as well while we do this?
Should you hang out on Twitch like in your personal stream? Oh that's a good idea. Maybe it's a blurry again. Sorry. Yeah. And then that way we could have our personal names on there as well. That is a great idea. Yeah. And then that way except you have to mute it. I know. Love Twitch and the autoplay. Hello, hello.
Hi all. Nice. I will, I will work on that next time. I didn't even think about it until we were just talking about kind of these comments coming in and stuff like that. So we're not quite as advanced as Jason and I don't know a few others with. I don't know how he does it still. I gotta look at like OBS coming in and we could do that. I'm working on that on my own personal stream so I'm planning on doing this live learning in public thing with the twitch stuff so maybe once I get mine we can do coding cats like together.
Sweet, I love it. Let's do a whole like tutorial on it. Yeah. Cool. Well, let's dive into it. So this is code with code and Cat. We're trying to do live code every Friday, at least when we're, you know, available and not traveling to conferences 'cause. I'm so and and when Britney is not picking up children and running around like a crazy person. Lucky.
Luckily mine's 13. He's like riding around his bike. Kind of independent, yeah. So yeah, where we kind of left off last time, Brittany was teaching me Svelt Kit, which was incredible. And we're kind of attempting to build coding kit on Svelt Kit. And so today we're going to show you how to like add a Notion API if you are using Notion. And then we're going to hopefully, if we have time, get Tailwind and Daisy UI installed and then see if we can make some pages.
That's who came on before. I'm sure he would come back on for sure. Maybe we could talk about how spelt actually works or something. Learn.spelt.gov So maybe you were right and I just typed it incorrectly. Learn dot spelt. Yeah, I think that's it. That's the one I saw the other day so. It's got the web, can be for everyone. It's so nice running spelt kit in the browser. Maybe we can use this as an iframe to our tutorial? Is that like illegal?
I don't know. No you can and all of this is open source so you would be able to like the spelt ripples open source too. Hey thanks Xanax, I have to get my clip from my stream the other day set up because Selma tried to share my clip and it was just blank and she's like you need some clip hygiene on twitch so I think we probably need it for coding cat too. Yes, yes, I wish.
Anyone want to volunteer to run like our twitch? Let me know or I could throw you some cash if if we need to just DM us. OK, so I think we've we've gathered a quorum as they say. I don't know why, but that's what they say. I think we have some peeps hanging out and so I'm going to dive into Notion and kind of how to get that set up first. So if you are ever using Notion on the front end and you're like, what does the API do?
You can go to developers.notion.com. They have great guides out here on different ways to start up and like work with databases. It can be pretty confusing just looking at blocks and how child blocks are used and things like that. If we want to I can get into the the Postman and show you kind of what ours look like in different things. They also have the API reference so we can refer back to this if we have questions.
Brittany might have froze, so hopefully, hopefully she makes it back. Oh, there she is. OK. Sorry, this Internet thing. That's OK if you need to reboot something, I'll just be hanging out. So I do I need to restart? It's telling me it's going to do it automatically in 3 minutes so I'm just going to restart now and maybe get the Internet back in check so I'll be right back. I'll tell the peeps how to do an integration. All right.
So basically when we're looking at the developer API, in order to use this within a Notion workspace, you have to set up an integration. And an anger integration essentially is the same thing as a user. It has a little more like maybe not pared down rights, but a lot more generic rights, I'll say. So currently we have this development space for our Notion that copies over like our production data. So we can hit that.
And Notion is not the perfect thing to use for an API yet. I'm working on some some Cloudflare, Cloudflare cloud something workers. There we go either on GCP or write some Lambdas. I was checking out edge workers too. So maybe put a Redis cache in front of this stuff. There's a there's a couple options, so if anyone has suggestions, let me know.
For caching the Notion API, but you're only allowed three API calls per second, but it allows for bursts too. So actually this might be important for those trying to check this out. Let me see where that was at. I think it's in capabilities. No, no, no, shoot request limits, totally missing it. There we go.
Yeah, so here is your 3 requests per second. You can do a lot to like mitigate that with the 420 nines and retries, but if you're trying to build an entire static site like we're going to be doing, you're definitely going to get that burst. And so they do call that out somewhere. I guess it doesn't actually say it, but I believe I read somewhere like if you have 2700 calls within 15 minutes or something like that.
So we can build our entire production site. I don't know if how many pages you could do with that, but we actually leverage a lot of ISR on ours too. So if you're not familiar with ISR, we can actually put our most of our static site pages out there. And then for the ones that we don't really care about during our build cycle, they will build on demand.
So that's what that's all about. On the next GS side. OK, that's for next GS. We'll see what's felt good, good news for the integrations now. So we have our development and our production one. When we dive in or you dive in to go add a new one, you can click create new one. And we'll just call this, I guess I think we're going with CCD spelled kit. And then this is the important part. I kept skipping this.
So we're actually going to pick that development one to code against, at least for now. We might have to change this later. Do I have access to that one? I don't know. I'll check. If not, I'll add you because that'll be important for our future because I'd like to get us working on development and development. I have so many workspaces I don't see it, so I don't think I do, but no big deal right now.
So for the API side of things, realistically you only need the read content. We're doing a lot more with our AP is where we actually do like a calendly integration and write our own cards when someone schedules a a podcast and things like that. So I actually use multiple. I should break that out to a different API.
I'll probably do that eventually, but we'll get there for R6. For this tutorial, we're just going to leave them all on. Make make my life easier in case we do something else. So now that we have our CCDS felt kit I'm going to go off screen in a minute because I believe we tucked away some dot env file and I messed up the the name on this completely last time we're coding.
So it's dot EMV instead of dot EMV dot local is that was that the issue And I, I was in and out last time so. Yeah, yeah, yeah. So for those of you if if we left off and things were somewhat broken, maybe hang on one second. I got to find Finder here, open in Finder, Reveal. That's why I screws me up.
Reveal in Finder. OK, yeah, so if you left off last time and you're having issues, I think we had ours name dot env dot local, which was a problem. It needs to be dot. Envy that was a problem for the dot envy package, right? Because Felt kit I think comes by default with the dot envy dot local file.
Oh really? That's interesting. So I wonder why we needed that then? So we'll do some research and put that in the tutorial. I think it was the package that needed it. OK that makes sense. I know James was having some issues too out in Learn build teach and I think we got him sorted around too so there's some oddities.
You don't think there can be a slash in the URL? What were you say? I don't think it would be slash and then a.com after top level domain comes before path. Learnbuildteach.com/community Did I say it the other way? Sorry. I was just kind of giving you a week, but it's all good. Maybe I heard her wrong.
I mean, it's Friday. Oh no, yeah, it's probably me. I have been to like five places already this morning and it is like 11:00 here so. Why? Why? Why? Are you having trouble finding the environment variable file thing? Something. Mentally having trouble today. I would love to get this working where I could like either code along with you or I could do some coding. Yeah, I would love to share it with you again. So let me share that over.
Oh, you can't even find it in VS Code I. Have to keep opening. You hid it from yourself. Yeah. Oh, let's see here. So I have development that that OK. I think for the most part I can delete the rest of this. I might be breaking something, but we'll get there. OK, so now we have somewhat of the correct keys.
No, this is and we can burn this one down. That's not a big deal. I just don't want our production one out there. So yeah, definitely. Now I show the whole thing, definitely copy the whole key, and that's what you can use for what we're going to do with our calls. So you'll put that in a dot env file. And now I'll go to VS Code.
I'll actually kick off live. Share Let. Me kick this off and see if you can log into it. Yeah. I think. I think maybe. We're going to see. We're going to see if my computer agrees with me today. It's already being finicky. Tried to install updates on me in the middle of a string. Just saying that the live Sri Lincoln private OK, so here we are in Sveltkit.
We have our dot env file that we are pulling in to different routes. For example. This is the part that kind of threw me off last time. So the slug dot svelt, this took in just our page data and we're looking at it. The slug dot TS is where we actually make some calls out. So for us just we're we're hiding a little bit and that's just because I wanted our data to come through correctly. So I basically copied all of our our server stuff from our CCD. So this is what the actual calls look like on a Notion client. So notion client dot databases dot query and that Notion client in order to initialize looks like that. So this is where that whole process, that env came into play.
I'm guessing it blew up on our client call. Failed request URL. Fun fun. OK. Do you know what icon package you're using in VS Code? That looks like maybe Material. Minus yes. Yep. OK. I'm going to take another look at what I'm missing in the dot env file so. Sign in. Please. I thought I I thought I had a good example going, gosh darn it. Can I see the error and stuff?
I can't get into the live share again. I don't know my it's not syncing a. Couple things over on. A mobile and then everything has two FA so it's like please do this on your phone and it's not sending anything to my phone Oh there it goes. Everything is going slow today. Winning collaboration session.
That sounds pretty, yes. Yes, except that. OK, now I can see the code. I have all our environment variables. I can see this now. So invalid request URL in the Notion HQ client, so that's not a spell kit error. Is that the envy thing that you were running into last week? You know what, let's let's check it out. So if I do a console log oops process EME dot let's do notion not token.
Oh this is annoying. Oh ha ha, ha ha ha, Yes. It is. No, no, it's totally my fault. I copied all the share links. So this is this is actually something good to show people when you are trying to fish around for like a page IDs and stuff in Notion. You actually can click the share and then go through that.
Oh, in collaboration section maybe that will work if I just try to copy the link and do it in VS Code. So this is not working in the browser very well. Our PC connection closed. Did you shut the server down and it closed? It probably. Yes. OK, OK, so it's not me, it's you maybe, Oh, I don't know it. It's still showing me in in the browser, but I can't get it running in VS Code at all.
It hates me. I think I can share the URL or the what's the word. I'm looking for the host as well. Oh oh come on, do it. Yes it did it in VS Code. I just had to restart it. Yay I. See your cursor. Would you like to view this in the browser? Yes I would. Would love to see that and I am getting it in the browser. I'm getting a home route in my browser. Nice, I thought, I thought I had all that set up right. So we're live coding together this week. It's exciting.
Yes. OK. I just we can't see your screen I. I don't want to show it just. OK, OK. Perfect one SEC if if you want to show your screen we can do that. I just have to delete your screen. Four more things. Share screen should be good to go. Share Yay. There's my screen and it's following Alex Patterson. We've got our terminal down here and we are working through this. I guess it's just a warning.
Now. Where's the actual error? Did it disappear? Oh, no, there it was. I just saw red. Database with ID. OK, so we are much, much closer now. So this is a good time to show you what I DS we can look at. So when this says O 6263 blah blah blah and I'm not showing my screen, so let me turn mine up. So when it has this could not find database. What we can do is now we can go out to Notion. Oh, you have to share the database connection somehow publicly but.
Then I remembered we created a new integration. Just a minute so on this page the way so if if everybody remembers now that we've, you know, messed around for far too long and we should edit this video one day. Basically, we created an integration, but in order to have the access to anything, you'll notice no one's accessing our page right now. You have to invite the integration. So we're actually going to invite CCD spell kit and actually I'm going to do this one to Meyer. So now that we have that, it should at that point be able to see, update and delete anything in our anything below this point.
You went to podcast and then now you're trying to grab the slug. So, yeah, OK. Cool. So there's all of our stuff, which is. Awesome. Sweet. Yes, that is really awesome. I have. A. Can I see our code? Let me see what I can do here with SRC routes folder. Is that opening and closing your file system too?
It like closed on me and I didn't click it so as. So you're you're looking at this we. Are iterating over. I am looking at the index dot spelt in podcast right now, right there, index dot spell. Yeah. So I just wanted to make this a little more semantic because I noticed that you've put a bunch of divisions in here and so we're interviewing over a list A. Quick one.
Folks, I know, so I'm just going to fix some of this real quick. So I'm going to do this and I'm going to wrap this in an LA so we have like a semantic list. See folks, this This is why you have designers on your team. Well, I don't know if that's a designer thing. That's. Just no. It's pure development.
Sorry. OK, so now we have a list and we'll probably have some styling things, but I assume we're going to get to that when we get to our next fun little thing we're going to add. Yeah, my larger concern is we should be able to click like 2.1 or something. So you're failing to load data. This is failing in the slug dot TS, the dynamic slug dot TS file, so it's failing in there to grab the stuff from the server.
And it says cannot read Notion page ID and then we have this ID. So let's go see what's up with our slugs and maybe there's a connection issue occurring here. So if we go in to our podcasts, coding cap perfect of streams. So we're at this level. So you are calling get perfect stream page HTML and you're actually trying to get the params off of that. I'm just trying to like follow along here what's happening. So params dot slug.
Yeah, yeah, we can. We can console log out that if we want to take a look at like what that actually is. And see if that's actually grabbing something there. Yeah, so let's do a console log params and we should see this on both sides, the client and the server. So let's do an inspect refresh. Oops, sorry, let me go back up page. So there we go.
Hey, how's it going, White Panther? I don't know if I'm supposed to call you that or if I'm supposed to call you Selma. And so I'm just going to does wing it every time I see you. Does Vtor's Feltkit not do a console log like this? It will. On the client as well. So. I see it on the. Are you are you grabbing?
So let's let's do Swix's 21 this one. OK, So now we have there should be there SO2-21 linking your micro services with workflows. So that is going to be looking up for EB 320484. I don't know why it's looking that up, but that's why it's looking at. So let's see in my dot EMV like I continue to not be able to show people which is kind of becoming a.
But I think that that EB 32 is a different, so it might be trying to pull like recents in 'cause we do like all the recent things too, like recent courses and all that fun stuff. Oh, and you have all of that in there. Yeah, that has to do it on the server side too. So let me find I don't see it in in here.
One more time. Oh, you're going to kick me off? Oh, I'm sorry. Oh no, maybe not. Maybe it didn't. It's interesting. So breakpoints, Do we know how to do those in Svelkit? Breakpoints like debugging breakpoints, JavaScript. On the back end. Can I do it in VS Code? Like put a break point right? There, try it.
I've never tried it, but just try it, see what happens. My guess is we have to set up the whole like run and debug side of this so. Because it runs that on the client. It's running this on the server side. Right, no. But I mean, is that where it normally runs that? No, no. Well, like there's a whole debugging on the client side, but on the the back end where we're actually fetching this data is on the server side.
So we need to set a break point within VS Code and there's this whole like debug listening thing. Maybe that's a good exercise. Can't you just do debug like the JavaScript debug there? I mean I don't think you can pause this, so I you can't do like debugger or anything like that. What does that say when you hover over that? It's unexpected, yeah.
Debug server in spell kit? Maybe I should search that on this app so everybody can see that. How do you debug spell kit server side code in VS code? That's a good. Ten months ago. Holy. You know, convenient weighted. This doesn't work currently because of how V exports source maps during the dev process. So that might be a thing that is blocked by Vt, but it could have been fixed in the 10 months since that's there's the AT debug tag in spelt kit, but that's in the dot spelt files. That's what you're looking at or no, that's what I'm looking at. You want me to share your?
Screen. Yeah sure, sorry. I wonder if we can actually just do just a normal node inspection. Node is already running, we can't add inspect retroactively. It's easy to start the dev server with inspector, without adding the run script, without editing the run script. Oh, because MPM run dev is already running and so you can't add in a parameter to it while it's running without restarting it.
So if I do that and then is she saying come back here and I can put it back in? Put it back in, but then the in the terminal there. There's a JavaScript debug terminal in VS Code and I don't remember how you got to it, you just had the options up there. I think, yeah. Click that and that. I think that's just the normal terminal area. There it is, that one.
I wonder try to see that makes sense. Nikki was just doing this on his stream yesterday and I will find Nikki's Twitch stream to link out for everyone 'cause that was a good watch so. I'm wondering if I just leave this this way, would that work? I feel like no matter what it's hitting that too soon anyways. OK, maybe I will hunt down this page and we will do a whole debugging section next time.
This is our page. And so kind of back to that whole Notion thing, how do you get an ID? If you go into Notion and click share and then copy link this, this is the actual ID right here. So EB7525, is that what's in here? 7525 that's correct and it can't read that page, so it's like it's not accessible. Yeah.
So let's see under the share here we have our development or our CCD. It says mixed access. Oh so we can edit as the CC DS felt kit? Yeah. So let's let's take and click share here and it says can edit CC DS felt kit. So that's like all the accesses. My only other thought is maybe I had issues with this before where like dashes were showing up. Maybe that's the issue?
Dashes were showing up in the URL. In the ID for the page. So like here. See how this doesn't have dashes? And it does there. So let's go ahead and we'll do the old manual some. JavaScript rejects and extract them to match it. Say, say that again, I'm sorry. Could you use some JavaScript rejects to extract the dashes?
That is a compliment, yes. And unfortunately we're not even really showing this felt part here. We're having trouble hitting the Notion API. We're getting there, but hopefully this will be easy or at some point. So we, we did our search. It's supposed to go find it by slug. And then I don't get the whole because it's already got the data there. Oh, right, blocks.
Again, I don't want to mess with keys. Let me do this this way. So at slug dot TS let's just follow this path. And take that debugger. Out anytime I I pair a program with Brittany, if she sees red line she's like fix that. I'm like, I can't. Stand. Them when we do this call, what we can do is right here at the notion dot dot notion client dot databases query. Let's take a look at what actually comes out of this raw. So let's do let's do a console dot log and then you can actually do Jason that stringify. So we actually see the whole thing raw and then it's like level one, right, Something like that. We'll just.
Do oh, it's too common null, right? Is that what it is? It's something so it like formats it kind of nicer. Yeah. Oh, no, I don't think that's right. No, it doesn't look great. Stringify. Oh, I put the two in there. Sorry. I'll just do it like this for now. But here is the Jason payload that came back.
I just want to show people this so I'll drop it into VS Code. Oops. VS Code's going to make it pretty for us with Jason. Ah, nice. This is this is what we have in here, this big old mess and what this actually is. When it's searched by slug, it only brought back or should should only bring back one post.
Front matter? What's grey matter? Grey matter is like green splatter, right? Grey matter is the package you can use to on pack from. Oh my God. It's gonna be one of those fun days, I'm telling you. And we've already clarified we haven't been drinking, just Mountain Dew, so. Not yet. We're gonna start early.
And so I had to kind of stitch it back together. So like I had to put things in like cover video actually comes through as this and I've got to like just slam it back into cover video. So this whole formatting piece is just going and getting all of those posts put together. So that's that's the whole like here is just the post data part.
That POST data is grabbing off of that big Jason object that you just showed. Yep. And so if we walk back up the tree, so let's go down one more time. So now we're in here, we say, OK, well now that you've gone out, you got the data, you've put it all together, 'cause our data is a mess, you cleaned it up. Now we're checking.
Do you actually have results? Yeah, we have results. Now we're going to actually go and fetch this URL and so that URL right there, that should be the correct ID. And I think this might be where our problem is. So I think this we'll see that same ID that we were seeing over here. So let me bring that back up.
It's not saved. This is saved, Jason. It's not safe. Oh, I see. Let me let me just comment this out so we're not getting such a mess in here. OK, so now we have in here. Here is here's the ID that we're we found here is the URL that says linking your micro services with blah, blah, blah, blah, blah. And so that's where we're going after to set up the rest of this call.
So right here where we say raw results go get the URL, this Notion page to HMHTMLI believe is looking for a page URL. So you'll see this page URL right here. Now I don't know what this package does. Someone suggested that we try this out so. Notion page. If we go take a look at this, I'm guessing that it's not using the client API.
So the the there's 22 versions of kind of the Notion API, if you will. There's the non public one that they use on their page. And then there's the public version, which doesn't do everything that they do. And then what a lot of people do, which I'm assuming this package probably does, is they actually go try to scrape a public page. And so my guess is if we take and create or take and look at this and we share this and just make it public to the to the web, if we now try to run this, my guess is this will work. It didn't error.
There you go. Look at that. So it's that package isn't actually looking for the data. So on on our stuff that we use can. We just write a utility function or something that will do that. Yeah, we can. Or use a different package. OK, so we just need to do something and not have each page be public because then anyone could go in there and edit it.
No public you can leave editing off. So it would be leave in public. I just I we're probably not going to. Yeah, and that's a lot to go back through too and make public. Yeah. And I like using like the standard APIs that they're providing to developers 'cause then we find out things too and find out our limitations and all that fun stuff. So we are actually kind of doing a very similar thing on Coding Cat, but we actually go out and fetch our our guests as well as our perfect picks and we concatenate all of that together onto a single page.
Yes, so to speak. Yeah. Actually it's it's all of the blocks for that single page. And then we go say, OK, we'll go find all of our guests. And actually, since Selma's out there, maybe we should show off. She was on Women of Jam Stack and we actually do multiple guests on that one. Where did that go?
OK, Command K folks use it. I love using it. Command K gets a search and you can go like that and it's not showing up. Did we not release that yet? Oh, you haven't released it because it was a live one. It's on YouTube, but we haven't released it. So our podcasts are live on YouTube, but then we kind of re release them in a weekly cadence.
Hanging out with Alyssa is always fun. Just that one Angular on air. Check it out. You can't. Even see a conference soon? Is that the one that she's in seeing? Yeah, awesome. I think she's doing Ng conf. Angular on air it's what? You so Angular on air is their podcast and then with Shorty and then Ng comp is the big angular conference that frosty kind of started and it's ballooned.
So we actually just keep pages up to date and I'm realizing I'm showing emails. Oh shit, sorry that one doesn't work. Anyways, he's not there anymore, so we're good. So when we go grab Sean's page, it actually has all Sean's details, his profile. So anytime we have somebody on, we can just tweak that.
We don't have to keep like going and creating on our page over and over. And then we also have our perfect picks, which my son has been so kind to update all of our perfect picks into a database. Finally. I think he's most of the way through it. Brittany can attest we've gotten a bazillion alert says he's doing it so we can go look at all of our perfect picks for every single episode now.
And what we do on this page, we look up the guest pick and Brittany and I's pick for this specific episode and we glue that together too. So there's a bunch of stuff going on in the back end before we like even throw it up to the front end, at least for coding cap. So to keep it simple though, what we can do, Brittany, we can do this kind of two different ways.
OK, so do you want to drive this or you want me to? I will. Do you mean like do the live coding? Just as far as you had some trick to install. Notion I do have a trick yeah, I'm looking that up right now so I make sure that I do but it's going to be spell add is the command that we're going to use so in your terminal you are going to have to shut it down OK and we're going. Because I know I had a hard time seeing it when I watched it back.
Put it over in the private chat, the command that you're going to run. Sweet. OK, so it looks like we're using. Oh, this isn't even the normal CLI, so they have just an MPX command all on its own. They have a spelt add command for some popular packages that will set up all of the configuration for you immediately.
Like you don't have to do anything which is super. Nice, that's cool. So I'm going to click that cross my fingers type of thing. I I hope this magic works. It's going to install a bunch of node modules for Tailwind. Let's see what it changed on package. Let's take a look when it gets done, set up and repaired.
Oh my goodness. Yeah, because you have to install post CSS, you have to like this is all tailwind stuff. So you have to install Tailwind, install, post CSS install. What are the other things? You have to have a Tailwind config file, you have to have the post CSS config file, and all of that should be done once it's done installing all of that. What's it saying underneath our?
Face saying it can't be guaranteed to be fresh. Maybe it is, maybe it isn't. If any issues arise after running this command, please try again. I think some issues arose because. Are you using YARN? I didn't use yarn, but. It used it detected YARN and ran that by default. That's MPX that did that. Then because you have YARN installed on your system, it just did that.
Oh, interesting. The the weird thing is, it didn't. You don't have a yarn lock file. So let's just double. Check. Tell me is right there. Tell me is right there. Oh, am I blind? Oh, it's in our dependencies, not not dev dependency. Thank you. No, it is in dev dependencies. Oh right, because the post CSS.
Where is post CSS? When it runs I mean. No. Oh, there it is. OK, yeah, it's all in dev dependencies. So it all installed everything. You've now got a post CSS dot config dot CJS and that's one of the tricky things with spell kits because it uses ESM. So having those common JS config files was a big pain in the butt when Spilt Kit first came out, trying to configure all that on your own.
So this command will run that and do all the common JS things that you need. Nice. I'm going to actually do a commit undo because I think it's snuck in. Yeah, that's that's what happened. So here's all the things that added. Oh, OK, Yeah, there you go. Cool. And then I'll then I'll recommit. So now we can splash around Tailwind or can we install Daisy UI 'cause I'd like to use that first? Well, let's make sure that Tailwind is working before we do pile on Daisy.
Make sure, let's get. Yeah, so we probably have some issues. Can't find modules, so you need to run an MPM install that's. Why? I was just going to say you are on it. I am sometimes. You're always on it if you ask me. That's why Network I hired you. Hey guys. How's it going? Who is Emma Huggins? Do we know Emma is?
Mark, is that right? Am I saying it? Is it Mark Huggins? I think so. Is it? Is it on? Yeah, I think so. Cool. Yes, that's right. I yes, from lumber the seat. Run Gov Gatsi. We are doing some spell kit and some Notion API stuff and now we're installing Tailwind and we're going to try Daisy UI. We have Tailwind running on our main site right now, but. Do we need to just try a little tailwind command? Yeah, so let's open up the SRC folder and the routes and look in the layout file and see if it connected the CSS. It did.
So it imported your app dot CSS for you, which should have your tailwind stuff also. So tailwind should be working if you like. Tried some tailwind around something in the HTML somewhere. Let's go. Index and make something fun like I don't know oh, colors are going to be weird because I'm so used to our primary, which I think Daisy UI uses. So let's see if I do class, Oh my gosh, I don't have to write class name.
No you don't. It's just HTML. React world baby. This is awesome. OK, so back BG slate, no something fun purple. Purple. Try purple. And yeah, there we go. Let's see what happened. It's probably going to be some awful colors, but oh, not terrible. I wish there was a package anytime I put like background purple and just makes the font the correct color like here you go.
Oh, like get grabs the correct one. You could probably do like some sort of alias or something that would do that. Remember when we were using Nightwind like yesterday, how it would flip? So if we had a primary color that was very light and you went to dark mode, it would just automatically calculate it.
Yep. We should do something like that. That'd be cool. All right, let's do Daisy UI. OK. And I know Scott Spence uses Daisy UI all the time in Smell Kit so I am going to try to find. I'm going to do the NPM commands so NPM installed Daisy UI. So I know Daisy is a little more opinionated than tailwind.
I don't know how much Daisy. Is AUI component library, so you have like actual components where Tailwind just provides you the utility classes that you can create components with. Daisy has the full-fledged stuff. And the cool part is that Daisy is still using Tailwind under the hood. People are just creating these components. So a lot of pre built stuff, but you can keep going with Tailwind on top of it.
So this is by Tailwind Labs. This is another cool one for components. That one's not paid. Tailwind Labs is paid. Yes, exactly. OK, there is a spelt tail headless UI too. So we have spelt components with headless UI if you wanted to use that there. Is that's cool? So if I look at like, oh, they're just not like listed out here yet. It's not a headless, it's not from headless UI. One of the commit community members ported it over to spelt though and rent it.
Sweet. Well, good job. I don't know how to say his name. It's RGORRR Hargua. Hargua. I hope. Our our quest, I don't know. OK, there's a link to that. I'm a poor American. Is is headless UI framework agnostic? I believe that they have one for each framework. Yeah, yeah. So because, because Tailwind is just CSS at the end of the day, it's all framework agnostic.
The cool thing about did I close headless? The cool thing about headless is they actually provide the React parts of it though, so you can copy direct. Let's see here. So yeah, see how it has React in view. You can actually get the code directly for so like class name. That's a very tell telling sign that that's a React right there. And then if we go over to view, I should flip it and show you the view code, which is a little more challenging, at least for me.
Here we go V slot. That's a good call out. So it gives you the actual like code for those items too. Now Daisy, I don't know, I think it's just straight cssi believe Daisy. UI OK. I go to an alert. What's that for HTML? So yeah, it's it's just got this kind of set up where it's just using Tailwind straight classes. So you're not going to get like if you want to use Daisy in React, that's not thing right now. I'm sure they could do it because it's it's very simple to like set that stuff up.
Yeah. So the cool part is if we ever want to use headless UI items too, they're just again, CSS, we can drop them in anywhere. There used to be a big community like Hailwind Components, I think it was called, I think it's this one. Yeah. So this is like a community driven one. If you ever like are out here and you want to check out something and grab it totally open, definitely try to give props to these people. They work really hard on making this stuff. And yeah, All right.
So I think with all that said, Daisy has a very specific way to do like their layout. If I remember it's, it's been a minute. OK, but you're going to have to configure Daisy to work with Tailwind too. Yeah. So we need to add the plug in for that. OK, this is just talking about it and so let's do the config. So it's got the Daisy config here and then these are optional.
What do you think? Let's just throw it all in for now and see how it goes. What is this? Those are optional. Let me see I. Think it'd be cool to have like the styled ones so don't have to style everything right off the bat. So for folks just kind of catching up or if you hopefully we put chapters on this one. So if you are looking at the chapters, hopefully you just jumped into this at section of how we're installing tail one. Basically we ran NPX felt dash add at latest tail one CSS and that put tail one in and it configured it all correctly, which was wonderful.
We then ran NPM, installed Daisy UI, and we're just about to add Daisy UI as a plugin to Tailwind. You just need that that I just put in the private chat in your Tailwind config. So in the plugins you just need to require Daisy UI and you don't need that config, it's all optional. I think I I think I grabbed all of the cool. So I thought there was.
I thought they had a layout component. Maybe I'm crazy because they have specific like themes I believe. Yeah, you can like swap out the themes really easily, so maybe under the themes tab. Maybe maybe we should mention also that Oh yeah, here it is. We should mention also like why I kind of like Daisy UI and this is something when we were building our site, you, you kind of were like, why don't we, why do we keep writing all this classes? Why don't we just create these components? So what they they've done, and the reason that I kind of like the idea is the same reason you were saying it before is instead of all of this stuff, for every single time you put a button in, you just have a single button, which Brittany did on our site. She did primary dash button or button Primary I think. Yeah, something like that.
And so you make utility extra utility classes that include the utility classes. Yeah, which is cool it, it definitely simplifies things. And Daisy UI is doing that for us on this. So which is nice because then we can just theme Daisy and hopefully use the majority of what they have and then add our own.
This still does add the same complexity problem though, where you have each of those on one button. Unless you create a button component that is your atom, you're still going to have to change that in every instance of your button. You mean the like having the button primary piece too? So like if you created a component called Button and you put that on it and then created props for primary and secondary and had it update the class based on which one you put into that component.
That's like making your button atomic. So you have like 1 button that you're using everywhere on your site. So you just have to change it in one place. And that's what I was talking about with Tailwind. And it would be the same Problem here is that you would have to go and find each button and update your classes unless you create that one atomic button.
But if you have that button duplicated on multiple pages, then what are you going to do? I mean I would just update the button primary piece right? Maybe I'm maybe I'm missing what are you're adding? So if you if you have a button that's on multiple pages or routes or like in different areas, you're going to have to change that button primary in all of those spots if you're updating the code for all of them. So if you have if I wanted to like look different, right because color.
I don't know how I can explain that. Different. I know I'm I'm missing something and that's fine. I would consider this at the atomic level because it's just a raw button at that point. It's it's a raw button in one instance though, unless it's a button component. Which has. Been reused. That's what this is at this point. So that's that's the.
But you're using it in a file in a page. Yeah. It's not atomic. So that that's interesting like definitely want to talk about that more. We should probably like where we at. We got 20 minutes for 90 minutes. How far do you want to get with the actual like visual? And then maybe we do a whole atomic discussion. OK, just just get something on the screen and then I'll I'll show you what I mean.
OK, so there's our. There we go, we've got the dark screen that is not accessible now, no. I'm surprised it flipped to dark. I wonder if I you. Had that purple in there, so maybe take that purple out from the tailwind code. Pick that out. So that's wondering on our button, I'm surprised, I guess that's accessible.
That's that's probably accessible. It was that Gray text on that purple. Oh yeah. Yeah, that was my bed. Cool. So we have we have a button and if we ever wanted to change that to be like our button primary, we can go like that. And then we have it. And the cool part is if we ever want to swap this theme out, we just like on my Alex Patterson, I'm actually using this, this is Daisy. And we can swap that theme out to like whatever the user wants or just something we want.
Brittany told me the other day. I don't know if he can hear it, but when you change themes on my site it purrs. It purrs and then if you do them like really fast, it's like on top of each other. It sounds really funny. I can't hear the purring sound of. The cats, right? It does. It sounds like tigers running across your.
I think we can just design on the fly. We can see what we want, but I want to do that from, like I was saying, the atomic level. So I want to start with the component. So if we're designing our button right now, I want to break this out into a component first. OK. What does? What does that mean for you on top of the component that we're using here? So that that you're using is not a component that is an HTML element.
OK, I'm talking about making a spelt component called button dot spelt. And what's the what's the advantages of using spelt components? So then you just have an atomic component. So that component's going to have that same code, but you can make a prop out of primary and secondary and you can update each component instance to whichever instance of the button that you create. So you have one button in one place to update your code. And that's so.
So do you want to in the SRC directory? I want to do it however you guys usually. Top top level oh at just like we usually do. So in the SRC folder create a Lib folder we'll. Make this very very felt friendly. And then components folder inside of that. Because this way we can use the default aliases without setting them up too. We can use that dollar sign Lib alias. Oh yeah, that's right.
Or just retype it. Either way. Cool. OK. And so here what we want to do is we want to create two props, right? We want a primary and a secondary button is. That a script tag. So you script tag Yep. And you export the props so that they're accessible by other components. Export let. You can do primary and then secondary. We can do this a different way too. So take export out of that and then put secondary on a new line and put let in front of it.
You have to do this part separate. So do let primary, let secondary and then underneath that do export and do curly braces primary, comma secondary. Cool. OK, so now we need a way to make that primary instead of it being static there that needs to be dynamic. So we need to wrap that class in back ticks to use template literals.
You can set a default if you want. Yeah. I'm trying I, and again, forgive me, this is this is your world, not mine. I'm trying to figure out the advantage of this over just being able to specify like primary, secondary on all of the buttons. Because those live in many places and they still live in many places, but you have the ability here to set what your atomic level things are.
And. You could change anything about the button, the padding, the stuff from one place without having to go to each instance and do that. Gotcha. So like it's, it's if whatever we wanted to change all of our buttons instead of having a block or whatever they come out as. So instead of having them all be large, yeah.
So that's in one place instead of it being. I'm slowly getting there, see? Sorry. I know that was a little convoluted, but I. I think what I would actually do then maybe I'm still trying to think how you would pass this in all over the place, but I might almost just allow the whole class name to be passed.
Oh I know how we would do it. We would create a ternary and we would say if primary then do button primary, if secondary do secondary. So in inside here you're in JavaScript land. So primary question mark and then you can do in quotation. Marks primary, are we just going to do the two? Because then I'll just do an order. I think for now we just need to, but I don't know. That's the advantage of having it in one file though. You change it in this one place and it'll update everywhere. So you need that in single quotes or in like some kind of quotation marks because that's going to string that. Value to this right?
So actually if it is primary, we would use the value if it's. Not no. You actually need to use that in quotes like you had it because what this is doing is concatenating button to primary. So it's going to say button dash primary if primary is true. I was just thinking like if if we wanted to pass a different value and we would then set it.
secondary. And so up top you're going to do let primary equal to true. So this way if primary is defaulted to true right now it's going to concatenate that BTN dash with button primary. Yep, cool. So now if we pass secondary in, it's going to pass the secondary piece in. So you actually don't even need that secondary variable right now.
It's not being used. Does JavaScript run like? Do I have to put anything in here? It seems like like this of HTML but in order to run a string like this. It runs once you have curly braces, so that dollar sign in front is not right I oh wait. If we're if we're accessing any variables, I would have to do this, but we can we can put another one in if we want.
Yeah, let's put another one in and then. So you do need, you don't need the dollar sign. You need the curly brace and then the back tick. No, go back, go back, go back. I meant undo, undo. I should be writing this. I'm sorry I. Thought I thought you have access to. Me so put I do where? Where are we at?
You're in button dot spell. Button dot spell. OK, that would be way easier wouldn't it? There we go. OK, so I thought you were just tired. Today with the like the kids pool stuff. I'm sorry, sorry. So OK, so now we see that we're in JavaScript world when we get this first curly brace. So we're going into JavaScript.
We're doing a template literal and we have a string. We have a string BTN dash. And then we're checking for the primary value. And if it's primary and it's true, it's going to put that primary right there. If it's secondary or if it's primary is not true it will. Oops I didn't mean to do that. So that is our button and we also need BTN here also right? Because it's button and button primary. So we're going to do that for all of the values then because they do have they, they do have defaults I believe already on there.
But that would you would need some kind of function to like do that. Yeah, I feel like then we're just reinventing what they've already invented. Yeah, and you wouldn't want to do that because then in each instance of your button you would be picking a different thing. How would I, how would I like actually use a button success then if we wanted?
OK, cool. I I like where we're headed though. So that is that kind of how you create a svelt, this is svelt component at this point. There's a spelt component, yeah, so. Is there anything more to spelt components like react? I get the props thing. It looks like anytime you want to execute JavaScript you just put a curly brace which is exactly like react JSX or JSX. Thank you.
Is there anything else that might be different than JSX world? There's some different. You don't have to return anything. So anything under. So you have a script section for your JavaScript. You have your markup section which is just HTML. Once you have a curly brace, you're in either spelt templating or JavaScript.
So like you use the pound each the other day. So that is a spelt templating block. There's also an if block and an async block. So you can use those templating blocks in that markup section. And then there's also a style block. So if we weren't using Tailwind, we could come in here and we could say button and create some styles on this button.
And even though I'm using the element selector here, this is scoped to this component by default. So it's it's like CSS modules without having to deal with a separate file and having it. That's cool. So would you mind just putting something out there and I'll, I'll show the screen where because I think it'll put like a little hash CSS in there? Well, that's an ugly color.
Cool, cool. We're not using that. Button. Oh, you're not using it? Oh yeah, I'm like what is happening 'cause that probably. Would have yeah. So this is a good point. How do I import spell components? OK. So like in your index dot spell file, OK, I'll do that. So over in the index dot spell file for podcast is that's where we're at, right?
We're just at the main page. Yeah, the top level. We're going to do import and we're going to import the button from and we're going to use this dollar sign Lib, which is kind of funny, but this is what comes with Felt Kit by default. So that's just passing that for us without having to do the dot dot slash. So this will get us to that Lib folder, and then we need to go into components folder and then that button dot felt file. And sometimes the Intellisense does the little red lines and then that and then where did we want to use that button? Wherever.
It did, we just lost the Daisy styling, right? Yep. So if you put BTN, you'd at least get the. Rounded for one room, I mean that and border radius, I mean, yeah. Cool, so it's hot module as well. Room 0.50 Yeah, the hot module reloading is done by V and it is really, really fast. He's he's super fast.
So the other cool part if we. So here, hang on just one second too. I want to go back and do that button and put. Let me just show him the the CSS part and then. OK, yeah, show that and then I want to show the Daisy UI how we could change that prop. So what Brittany was talking about, when it's localized CSS, it actually appended. Veet does this I believe.
So it appended this kind of hashed CSS class right here. And if I do a find that is the actual style. That's actually spelt that's doing that. Oh, is it OK? Cool, So I didn't realize the bundler wasn't spelled. That's awesome. So at this level, you can find that style and it's calling out exactly what she wrote in here. And the nice part, if you look at this, I don't know how you wrote it.
Hopefully it's Tailwind, right? Nope, you didn't. Maybe. Where? This. OK, I never mind do that and tailwind. I didn't know if Tailwind would automatically come. Up Oh, so I could so I could do at what is it at apply Yeah. And BG, I don't know what they're pink. Let's do a pink 600 and do text white P4 rounded large. Yeah, that that should work.
Yeah, they can see that. So it comes through as the regular CSS classes. But if you go back to the code real quick you can see that I had to put Lange equals post CSS here because it wasn't reading that at apply because this is regular CSS until you specify the language. And so the same thing I saw in one of our things.
You have to do Lang equals TS up here if you want to use TypeScript and not get yelled at. Those are great tips. Like we should just zoom a whole chapter right there. Hot tips. OK, those are hot tips. I'm going to undo a bunch here and get us back to the Tailwind Daisy UI classes and I want to show that prop. Cool.
OK, save that, go back over to our podcast. And so right now primary is true. So we're using primary button. Is that what that's using? Yes. OK, button primary. So if we do primary equal to, let's see if that doesn't work, we need false save. What happened on our screen? Nothing. What's coming through I can't see for our faces. It still says primary, so you have to refresh to pull in components Or is it hot module?
Should be hot module. Oh I didn't save it somewhere. I think maybe I'm trying to find where all my got too many tabs open. So button button primary then it's primary. Oh, it's always true. But I'm passing it in and saying it's false. Where Where is the button right here? Does it have to be JavaScript? That's what I'm wondering.
You. So we need to. Make another button that's specifically a success. I would just set it up to be props so that we would have everything living on that one thing and you can do classes in spelt that will check for certain variables and if those variables exist then it will put specific classes on it.
So it would just require more code in that button dot spelt component and we can look at like a headless UI component and stuff and see how that's done next time. That's why I was thinking, let's do a whole like atomic piece to all of this next time. Yeah. Please let us know. I know there's like 5 of you still out there. If you're enjoying this, getting anything out of it, We love doing it.
We love showing stuff off and it helps us create tutorials at the end of the day. And Brittany and I get to hang out on Fridays now and she doesn't get too mad at me even if I question atomic stuff. I'm not mad, I'm just frustrated at myself for not explaining this very well. No, it's me. And I'm going to look it up and we're going to have a better explanation next.
Anything else? Any other shout outs you got? You got more things coming. I I don't know the spell AMA. The Spell Origins premiere is next Tuesday and I'm hosting the AMA. I know Rich Harris is going to be there, Gauchermo and Sean's not going to be there, but there's like several of us that are going to be there at promoting right before the premiere of Spell Origins, which I'm hoping I'm in. I haven't seen it yet and I'm very nervous because I didn't get like the clip.
They're like, we'll send you the clip before so you can see what it looks like. I've never got it, so it's just going to be out there. Nice, I I think I saw you in here somewhere. Oh, my face is like, right, Yeah. Can you share that? Because it's like, I literally died. I was like. I can't remember where you were.
I have it. Let me share. Oh, you got it. Is it? It's. No, that's not it. Oh, that's not it. No, that's the trailer. There's the did I just Add all of us? I didn't. OK, so let me Scroll down. But like, I just died. Yeah, you're out there with some amazing people. Right. Oh, yeah. And Scott Telinski is going to be there, but Sean will not be there.
