Syntax Video
Syntax Bytes with CJ - CSS Battles | Working on Syntax.fm | Episode 5
Transcript
well hello there welcome in to syntax bites episode number five uh today we're going to be hanging out um we'll do some CSS battles we'll also work on the syntax. FM website um and just generally have a good time so thank you for being here um if you are watching this not live be sure to check the description we'll have time stamps to all the different things that we do and uh like I said we're going to do CSS battles so if you haven't heard of this this is a website where you're given a photo or a picture and you have to recreate it with CSS so this is the first one that we're going to try to do today it's like a circle with what looks like mountains inside of it and then the other one that we're going to try to do is to recreate the Iceland flag um and so I'll try to solve these from scratch and uh you can try to follow along at home as well and then after that we're going to work on the syntax website so
syntax. FM is website it has our podcast it also uh shows all the videos that we publish and all that good stuff um but it's open source and so there are a few issues on the GitHub repo that I'm going to tackle today uh there's one where we're going to make these buttons work on the homepage because right now on the homepage these buttons don't go anywhere but we'll make them actually go to those specific shows um and then this seems like a fun one as well so structure data for the podcast um that's not good why does this always happening I have to restart Firefox real quick uh before I do that let me let me say hello to everybody let me welcome everybody in uh we'll get back into it there's always technical difficulties and uh what's up NX it's good to see you hello Jonathan welcome and what's up suel and pranav and Mustafa and Nick and bukari Dev hello hello what's up pav who says this will be super helpful nice glad to hear it yeah and good to see you Andrew and and ala yeah it's live it's live right
now um and uh uh thank you to uh the mix nuts for the follow over there on Twitch so we're live both on Twitch and YouTube you can tune in wherever you prefer what's up Sue good to see you as well all right let me restart my browser I mean probably for good reason there's probably like a security fix I have like seven browser windows open and so now everything has to re reload just a moment
okay how about now so this issue is about implementing structured data for each podcast episode and there's a specific schema that you can include in your HTML so there's this thing called el Json LD and if you include this in the source of your page then uh various things like search engines or embeds can use this info to uh embed information about your site and so so essentially for every podcast episode we can add a little metadata object like this so that uh if the podcast episode gets linked in certain places it'll have all of the relevant info so that should be pretty easy to add but it'll be very useful for the site um those are the issues that I've picked out if we solve them quickly maybe we'll pick another one it's also possible that these CSS battles take me a long time so we'll see we'll see um and then before that uh we're just going to chat a little bit I saw this post first I I found this post over on Reddit which is a slight a slightly sarcastic
history of front end so I just want to go through it talk about it um and it was actually originally posted over here on LinkedIn so we looked at this but the the comments on on Reddit are pretty interesting as well and also let's turn on dark mode yeah beautiful um uh live after a long break yeah it's been it's been I guess over a month since my last live stream here on on the syntax Channel I mean and on the coding Garden Channel I've been busy I've been busy okay but let's dive into this and if you have any thoughts or opinions on this slightly sarcastic history of web Deb let me know in the chat because I do think it's it's missing things I think it's really what mainly what I know like if you've been around for a while and you've been doing webd for a while what do you think is missing from this list here I'll link it in the chat and I'll also it'll be it'll be nice to just uh reminisce and be nostalgic about the old days of web de
um so in 1989 Tim burner Lee invents procrastination yeah so he invented the web we all use it to procrastinate these days that is true uh in 1990 uh HTML was released because plain text was too boring so yeah I guess the initial web was just text like visiting text documents over the hypertext transfer protocol and this is my break timer we're going to we're going to take a quick quick quick stretch quick Break um so HTML was invented 1994 CSS was invented because HTML alone wasn't enough so this allowed us to do Styles and I'm not completely sure if this was actually external style sheets because CSS initially was just in the OR Styles initially were just inside of HTML um I'm curious about the creation of CSS let's look it up on uh Wikipedia
separating formatting and content that's exactly what this is so the initial release was in 1996 yeah so they have the they have it here as 1994 maybe they meant Styles in HTML because I think the um actual separate sheets was introduced later on I don't know if you know let me know in the chat and then JS was created in 10 days back in 1995 what could go wrong not much it's great here we are everything is fine nothing is wrong with JavaScript and then we have a whole 10 years of missing history uh this is kind of what I wanted to talk about too because uh before jQuery uh was introduced there were a lot of other things uh that came about um one that I can think of is is ey frames so um it used to be that if you wanted to maybe load external data or have a certain type of layout you could use iframes um and you could also have you could have like a master detail View with if frames
where like the left hand side was links and the right hand side was an if frame and then you could uh set a Target I think you can still do this but basically you could make it so that when you clicked the link here it would open that in the if frame on the right hand side a lot of sites were built that way um I actually built my my high school's website using using IF frames like that and then a little bit later uh Ajax was introduced let's look up when Ajax came out uh as refers to Computing programming asynchronous JavaScript and XML first appeared in 1999 okay so we actually skipped a few years as well but in uh when Ajax came out that actually made it so that JavaScript itself could request make requests for sites and data so instead of needing a full page reload or instead of needing to like load data into iframes you could be on the same page and JavaScript itself could could make requests um there's a good good thread
here on Reddit of people talking about some other stuff too yeah so 1995 to 2006 um so yeah iframes were 97 Ajax was 98 uh Json yeah was introduced in 2001 so I mean I remember the days when we didn't have Json and uh most of what was used on the web was XML um and I built like I mean this this was even after uh 2001 like Json didn't immediately become the def thing cuz like I was building soap apis with net basically apis that returned XML data and those still kinds of things still exist but uh Json has slowly taken over as kind of like the main data format on the web um 2004 the dojo toolkit was released I never used the dojo toolkit let's look it up yeah a modular JavaScript framework um designed to ease rapid development of
crossplatform JavaScript ax based applications and websites cool cool that's awesome and good to see you too a lot welcome in what else we got um I mean there's probably some other things in here too some people mention like dhtml which is like Dynamic HTML oh yeah and then uh silver light real play all so there's a whole era of uh like embeddable uh external things right like we used to embed uh like flash player we used to embed embed other types of things U like silver light so Silverlight was Microsoft's response to flash player in a way and that like you basically had to install the silver light player and then you could have Eds on your website that were silver light but you could actually write those with like CP and.net but then they can be embedded inside of websites um I did some of that because I did uh desktop development with WPF and zaml and
there's a you used zaml I believe in inside of over light yeah and then like real play like being able to embed like a media player with real player that was a thing for sure yeah and then there also Java applet yeah so there's a whole era that was still technically web dev webd but before JavaScript was as decent as it was these days with all of the the niceties and features and everything just built into it and HTML 5 and CSS 3 basically browsers have slowly slowly uh gotten all the features that used to require external plugins and external language as well so yeah that was a whole era for sure um what else yeah jQuery came along to save us from the browser Wars chaos yeah and the initial idea with jQuery was uh you could write your code with jQuery and then depending on what browser it was running inside of it would do the right thing because uh back then the the the browser uh support for features in JavaScript and also in CSS and everything else wasn't as
um how do I say wasn't as widespread as it is these days like if you look on can IU these days a lot of web browsers I don't know what do I search for um I don't know like HTML 5 that's like supported everywhere um or like semantic element sure but uh most browsers these days are evergreen browsers meaning like they they try to stay they automatically update on users machines and they're working really hard to stay up to date with everything and usually these days you only have to worry about maybe one or two things having like partial support across browsers and a lot a lot of web browsers these days are actually based on Chrome so because they're all based on Chrome they stay as up to date as the or they're based on the chromium engine they stay up to date as uh as Chrome does so Edge is based on Chrome um I'm thinking is Opera I know Firefox and Safari have their own their own engines but these days we don't really have to worry about the differences between browsers as much um so there is so jQuery isn't used for that as much J
is still used every now and then on smaller websites uh and Vivian good to see you welcome in welcome it what else uh angular I was there for the angular the day so Google's first attempt to fix the web angularjs was good I I feel like uh angular got a bad rap um probably because it made it easy to do things the wrong way which is kind of the boat that we're in in react right now react makes it really easy to do things the wrong way because it doesn't have a lot of opinions angular had opinions but you could still do bad things with with angular and I think and also the whole idea of 2A data binding people didn't really like that but I learned everything there was to know about angular and I could build efficient fast websites with angular I really liked it yeah then bootstrap bootstrap came along making every website look the same um typescript was introduced in 2012 you may not realize this but yeah the typescript is 12 years
old um I was actually at Microsoft build um I guess not when was released I think it was at Microsoft build in 2013 or 2012 and uh Andre hellberg was actually talking about some of the newer features in in typescript maybe I was there in 2012 I don't know I don't know and prom says typescript just love mixnut says half my age yeah um and uh react came out in 2013 Facebook reinvents the will beautifully I he that's not I don't know about beautifully they did reinvent the will though uh View and this is another thing people don't realize is view was released only a year later after react not even a year just a few months after react came out let's make react but easier to learn uh view was really cool back in the day uh you could think of view as kind of like the middle ground between angularjs and react because a lot of the directives in view like vif
and V4 and V show uh were inspired by angularjs which had Direct directives like in if and in4 and in show uh but uh view I I think it was view two that eventually got the virtual Dom so then it was more similar to react yeah thanks for the followers over there on Twitch welcome in uh Wy Wonder Woman and reworking good to see you uh we're going over this history of uh of the web sarcastic history of the web so feel free to throw your comments in the chat um I like two-way data binding I mean I do too I think the the issues with two-way data binding that most people have is it makes it possible for data to be updated potentially in multiple places and so then that at scale kind of turns into spaghetti code that's one of the biggest gripes with 2A data binding um and in things like vue.js which has like V model and uh has a you can create they introduced the create model thing it looks like two-way data binding but
it really is just syntactic sugar for the unidirectional data flow that you get inside of react where you uh pass down props and then those can pass the data back or like call Setters to get the data back up so it's still it's not technically two-way data binding it just looks like it I don't know yeah people really play Down Redux nowadays how I have to say in the early days uh it was magical yeah I I mean I was magical maybe but also very convoluted like uh here's my we've been talking about this for 10 minutes here's my break timer again um so and I mean and I say that just because like not convoluted I think anything that's functional programming es and is inspired by functional programming is hard for a lot of programmers to Gro and it was for me because I didn't really ever do any functional programming and so then getting into react it's like it didn't exactly feel like functional programming because the initial react that that I
used was uh was class-based so it kind of felt like o op but then it had like these functional aspects to it and then if you really wanted a nice way to handle State across your entire application you'd pull in Redux and then you had to learn about like reducers um and this whole thing and then what even what made it even more complex is uh trying to do asynchronous state with Redux and so one of the the larger apps that I worked on back in the day used Redux and Redux Saga and Redux Saga was actually based on generators and so that made for even more complexities and um just weirdness and you could call it a skill issue but I think like if you just take take some react Dev and then you drop them into a code base with Redux and Redux Saga and they've never seen it before it's going to take a lot of time to onramp and to figure out how hell all that works yeah because Rea management wasn't complex enough yeah but that said Redux these days is a whole lot easier and nicer to use there's the uh Redux um is it the
Redux toolkit is that what it's called yeah Redux toolkit um and they've they've basically removed a lot of the boiler plate they they make it a lot easier to use and learn these days but back in the day it wasn't uh and then react native was introduced in 2015 so that's great you could build a crossplatform apps with it like uh mobile apps yeah Prav says I started with a functional programming and maybe that played a role for me but yeah uh too many different ways to work with Redux yeah I think I think that's I think that's the thing um is trying to push functional programming on programmers who have never maybe seen it before um maybe it's not that they programmers don't want to learn functional programming it's just that like it's new and uh I think even these days I don't think react is really even sold as a functional programming framework but I mean it is yeah uh and then angular 2 came out I remember this um and this is the one one gripe I had about this list it did not have mandatory typescript this is actually
one of the issues about learning and migrating to angular 2 is most of the docs were written with typescript but they also said hey you don't have to use typescript and back in 2016 typescript didn't have the level of adoption that it has today so this was actually one of the big I think one of the big reasons why a lot of people didn't uh adopt angular 2 so basically the switch from angularjs to angular 2 was a complete rewrite uh they it same name completely different framework from the ground up with new syntax and new ways of doing things um of course inspired by angularjs but it is an entirely new thing like you would you would essentially have to rewrite your app if you if you wanted to upgrade um but I remember back in the day this was the issue like the docs were in typescript I hadn't yet bought into writing everything with typescript yet and so I was like all right well I want to use angular 2 but I don't want to use typescript and then I couldn't find docs on it it it was it was tricky it was
tricky yeah so the mix nut says every time I look to learn angular I just give up too much boiler plate where felt makes it easy I've been spoiled well I think this is one of the other issues that angular has is there's too many versions so I'm giving a talk on Monday at JS Nation where I implemented the same app in multiple different ways and I wrote the code for it the the the original code for it I've Rewritten it since then for for my talk so that it's up to date but the original code was with angular 16 and uh and then I gave a practice version of this talk about a month or like two weeks a month ago I don't know I gave a practice version of this talk but I had to upgrade everything to angular 18 and so when you're searching around for Solutions you find things that are for angular 16 which is slightly different and then angular 18 which has new opinions like the docs and the versions are all over the place it's it's not doing itself any favors yeah I'm not wrong by default uh would config typescript he you you can use JavaScript may maybe I I just remember
like I'm pretty sure it was possible to use their CLI and you could say no to typescript I'm pretty sure pretty sure I don't know uh and the nextjs was introduced in 2016 yeah because react needed a framework for its framework and then Tailwind came out in 2017 I didn't really start using Tailwind until like maybe four years ago so I I I didn't even like know about it or touch it until more recently yeah and then spelt 3 was released in 2019 um it was interesting to see uh the early versions of spelt actually looked almost identical to uh vue2 in the options API like literally your spel components would export an object that had a data property and like methods on it and stuff like that um so like it looked like Vue but it um uh I don't believe they were using the the virtual Dom it was like compiled um yeah that's an interesting historical note as
well yeah I mean this is this is the other thing about yeah using angular in typescript it's very enterpris all the decorators binding dependency injection um there's there's a lot I think it's I think for anybody that is used to the Simplicity of spelt or view um or even the do it your own way of like how how react does it um it can be a lot to take on I I will say though like you do see angular being used at larger companies because these types of patterns are all a lot of the programmers there already are familiar with them because they use Java or C but in the world of JavaScript these are like foreign concepts for a lot of developers so it's a it's a a steep learning curve um I still don't use much taing that's all right you don't have to I just I like the Simplicity of it like I I don't I don't I haven't worked on a project a team project with Tailwind yet so I don't know how that is but working on my own personal projects with Tailwind I think it's fine I think it's
great uh react hooks were introduced in 2019 um yeah this was fine react hooks are fine I don't know use effect is just so cumbersome and weird and there's so many rules about it and it doesn't automatically track your dependencies I don't know I don't know um then view3 came out yeah the composition API nobody asked for this is so this is another version issue and uh potential compatibil compatibility issue that happened in the view ecosystem where they introduced a new way of writing components which is the uh script setup so if you look in the vue.js docs you'll they show this by default now um well they used to template syntax quick start show me a
component um no that's that's the app show me a component okay never mind I can't find an easy example that that's usually not the case with the vew docs but uh they essentially added uh composition functions which would allow you to create state to have uh various effects Watchers and basically do things without having to specify everything inside of a an options object um and it Vue still supports the options way of doing things but this kind of like fragmented the community because there there were some breaking changes in V3 of uh of view and a lot of libraries took a while to update and so a lot of the ecosystem was like kind of stuck on V2 for a while and then the composition API basically it's you could think of it like react hooks but inside of view but better in a million different ways in that you can call them in any order um you don't have to manually track
dependencies um you don't have to use them inside of a component they actually work outside of components so the composition API is actually really nice compared to like hooks in react um but uh it has kind of has no opinions it's up to you as a as a developer to figure out how to structure your code with a composition API and so that's another issue that a lot of people had with it and still have with it yeah uh Andrew says I've been M migrating our front end at work from mui to tailwind and I love it wow it's like purely so mui is a material UI um that's fascinating did you find a Tailwind material UI library that like has things implemented for you I only say it's fascinating because material UI is pre-built components right like if you look at like their button they give you a button component that you import and then you and it just comes styled and and works like this uh Tailwind is just utility classes so I would expect you shadan fascinating that
seems like a big migration then cuz you're you're having to restyle everything unless you're not worried about making it look the same yeah if you're using Shad in that would make sense because that gives you like base components and then you're using Tailwind to to U um customize yeah and American 2050 says that's why I gave up on view look that look at it uh looked at it right when the change from V2 to V3 was happening yeah yeah uh the main reason we're switching is because we started our front end just building quickly and now we have a designer designing things ah that makes sense yeah and that's the other thing about using material UI is you're kind of buying into material design and which is a spec by Google mui is not by Google mui is an implementation of that spec but when you add it to your app uh you here's here's another break timer here's I'm talking a lot this morning um but when you when you're when you are using material UI you're basically opting in into material design
and so all of these components are pre-styled right they they look like material design um and that makes it easier to build but your site is going to look like material design uh but if you have a designer who is kind of Designing the components for you then it makes sense to build it from scratch was like shadan and Tailwind because you can style it how you need to yeah and and then that makes sense if you're if you're not if you're trying trying not to make it look the same yeah and uh gold Jun just saying for tailand everyone says it's it's easy but to write CSS inline in my eyes is so bad and it makes it unmaintainable well I think this is the misconception about Tailwind is that it's not inline CSS it is a um design system that is kind of just like hidden from you so inline CSS would make it so that um you could use different sizing all over the place in your app and not have any sort of consistency Tailwind gives you consistency um so when you look at um I want to see their there's like
their uh not the components there's a section of the docs that kind of just talks about what is tailwind and how does it work because there's a really good uh comparison to make here why Tailwind [Music]
maybe why oh I mean they have that here why not use inline Styles so they they probably talk about the utility class but this is this is the only thing I want to point at which is why this this is not uh inline CSS uh so take for example let's say you implemented something without Tailwind You' create your CSS classes and then you would add all of your Styles here the one thing to note about adding Styles like this is you now essentially have magic numbers right there there's 24 rim 1.5 Rim 0.5 Rim 25 pixels three rim three Rim 1 1 .25 R these are all over the place and um of course you could clean this up with some CSS variables but not everyone does that that would be the ideal way to implement this even just if you're using plain old CSS was to have is to have some kind of CSS variables that'll make it so that your sizing can be consistent across your app uh the thing to note about Tailwind is those sizings are kind of just default So when you say p-6
that's not a padding of six Rim p-6 actually mean and whenever you see the -6 on any sort of sizing that actually means .5 Rim um and so it doesn't line up one to one but once you start getting used to what their design system is and what these numbers mean your app is more consistent just by using these um because even if you so if you compared this to inline Styles you would actually have to say padding uh 1.5 rim and then um there's other utilities that aren't just like inline Styles like Max width small so this is actually adds a media query to say that the maximum uh size of uh what the what the maximum size of the container should be on small devices you you can't do that with inline Styles so there's a lot more to it than just inline Styles and I think on first glance that's what it looks like but there's there's a lot of niceties hidden behind these these little helper names here and then the other thing is like the design system of using colors right so like uh they have
a hard-coded color here of course you could use CSS variables but uh to have a whole system of colors like like this and using consistent names like this is really nice um yeah you can look at their color system and all of this is kind of just built in um one thing I'll point you to though is like if you if that made sense you're like okay I I could see I I can start to understand the Tailwind people now a little bit um one thing you should look at is uh but maybe you don't want to use Tailwind there's a thing called open props which basically gives you all of those CSS variables that I'm talking about out by default so uh open props gives you like you you add it to your page and then they have all of these CSS variables that you can use like Radius 2 size fluid Shadow 3 um and so it's very similar to Tailwind in that this is kind of your design system but instead of having magic numbers all over your CSS you can use the variables that are built into open props and have like much more
consistent Styles so if you don't like Tailwind I think you should at least be using something like like open props okay did I convince anyone um uh Sali says my company's in the process of redesigning and rewriting our angularjs app to spel kit and spelt using spelt shadzi in and Tailwind really been enjoying it that's good to hear yeah I mean spelt is definitely a joy to work in like I I really like their way of working with with uh front end and backend components um yeah let's see use VAR yeah like CSS variables getting to and Global styles to work without breaking muui um was a bit of a pain but I managed somehow oh wait so you're using them at the same time and then slowly pulling out material UI that seems like a feat you should write a blog post if you haven't yet um uh in Tailwind you would all have to use custom color variables too otherwise changing xcolor website becomes uh wide becomes a pain well yeah
you would you um you would change it in your Killin theme so whenever you're doing your initial setup inside of your theme object here you can set what you want your primary your secondary uh colors to be and then you can even override like what text red is or or whatever else so you could set you could set the colors there and you don't have to uh set it everywhere um if you use Tailwind with Dynamic values that is uh not something you should do let me let me see if I can find an example of this it's when you use the brackets it's something you should avoid because that defeats the whole purpose of tail in um like this so a lot of the tailin classes actually do support arbitrary values like this um and this basic it's this defeats the purpose of the design system so you should actually pull this into your Tailwind config and you can actually give it a name you could give
it a new color name and then access it on all of your classes versus having this hardcoded all over your your Tailwind code base so yeah yeah this is nice thanks for sharing this oh about Tailwind um is that what you're saying have I slightly convinced you or made you made you slightly less mad about Tailwind um yeah there are proper and improper ways to use either of them I agree uh I yink open props box Shadows because they are lovely yeah what's up B mind um I haven't personally used open props but if I start a project without oh open props is nice nice yeah yeah let me link let me link it um personally haven't built a site with it but I I want to give it a try what's up William Cameron good to see you love a bid Tailwind nice nice uh okay yeah yeah so that's that went down a rabbit hole of Tailwind where were we at uh yeah solid was introduced in 2020 um I remember trying solid pretty early on
and uh really liking it mainly like I I do think solid is kind of like the easiest on-ramp for existing react developers if they want to start to do more modern things like have signals have components that don't render over and over and over again um solid is very nice the new kit on the Block yeah uh HDMX was released in 2020 um react suspense was in 2021 chat GPT was in 2022 to fix Dev procrastination and create unmaintainable code yeah I mean yeah it does but I don't use it much uh and then server components were introduced in 2023 yeah so this was fun uh check out check out this post if you haven't yet I thought it would be fun to go over uh have a a quick trip down memory lane and then yeah there's some good conversation here if you if you're just joining us you kind of missed us talking about the Gap in the Years here so
there's a whole gap between 95 and 2006 and uh there was a lot going on back like in between that time like introduction of iframes introduction of a Ajax there was uh flash uh Java applets player silver light all of these app like applet anded based things that happened across that time and and it still happened into the the early 2000s as well okay that was fun let's write some code who's ready to write some code type one in chat if you're ready to write some code we're first going to do uh this CSS battle we're going to try to recreate this with using CSS only if you want to play along there is the link and um if if you uh come up with a solution uh feel free to throw a link in the chat to like a a GitHub gist so I can look at your code yeah in CSS code yeah I mean it's actually I never thought about this but trying to implement some of these
using Tailwind like a Tailwind CSS batt battle would actually be pretty fun as well um so yeah give this a try and um can I explain about server CI remind me when we're done with this CSS battle and all I'll do my best to explain that um but if you haven't heard of CSS battles if you go to CSS battle. deev they have a bunch of different battles that you can do um what I like to do is go into their uh past battles because they they actually do uh have a system uh to upgrade to be able to do some of the other battles but if you go to the Past battles you can actually do all of these for free see if you like the service and then decide if you actually want to do like their monthly payment to get the more recent stuff in their other battles but all of these past battles number 32 and before all of these are completely free to try um and we're doing battle number 46 and one of the ideas with uh CSS battle is it's actually code golf so uh you get more
points by using less code but I'm not that great at CSS so my goal is to just get it working um I'm just going to get it working I'm not really going to work on code golf if you're really good at CSS that's another way to basically challenge yourself like if you're looking at this and you're like oh I could do that in a minute uh try to do it with code golf meaning solve it with the least number of characters including your HTML code and and your CSS code here all right let's get into it um first up we need the background color so I am just going to set the body's background color to be that um we're going to do just a little basic reset and get rid of margin on everything and padding on everything and do a box sizing of uh border box on everything okay uh then this little div right here is going to be our Circle so
circle beautiful uh then I want to put it in the center of the page so I'm just going to make the body a grid and then should be able to do Place content Center please work please work yeah so it works but this uh page doesn't have automatic height so I'll give it a height of 100 view height boom it's in the center okay now we need to increase the size of this little circle I'm going to make it 300 pixels that's too big two pixels that is just right so it has this little slider thingy where you can see what you've done versus what you're trying to do you can also look at the diff to see how closely you you overlap so good to go I have I have a circle in the middle of the page I am a I'm a CSS developer I'm a CSS programmer okay my thought for implementing this is to create
squares and then just rotate them and then make it so that the Overflow of this circle is hidden so let's say I put a div inside of there and then let's give this a class of uh
triangle I'm going to give it a background color of this and then um I'm just going to put a class on this so that this the Styles aren't overlapping I'm going to call this circle and then replace this with circle and then our triangle let's give it a height and width of 200 well we'll probably have to resize it to figure out exactly what H it's Pro it's probably like
150 something like that so now this triangle Le is inside of the circle but as you can see it uh the the edges of it are visible if we say overflow hidden on the circle that hides anything any of the children that are um uh poking out of the container and then I want to rotate this thing so I'm going to do a CSS transform yeah positioning is going to be interesting getting it in the exact right spot like I know that I can rotate it using CSS transform but getting it down and the right will be tricky um but here I'm just going to do we just think it's a 90 degree rotation um let's try
it 45 45 yeah 45 um and then do we just do we just use translate to get it down to where we want it wow I've never heard of a conic gradient so uh Nick 39 cry says I wonder how hard it would be with a conic conic gradient did I say chronic CSS conic gradient so like a a cone gradient I have never heard of this whoa you could get it working yeah okay I don't want to do this because I don't have enough time to learn it right now I just want to get it working but that's cool I yeah I'm GNA I'll link to that I have never heard of this yeah yeah the the bot doesn't seem to be
working over on YouTube oh so here or uh links here are our socials and what's up uh nxs good to see you Kevin pal oh did Kevin pal teach you about conic gritty yeah shout out to Kevin pal uh his uh YouTube channel is amazing all about CSS the king of CSS whoa hello and welcome to my Chann there 92,000 subscribers that's awesome uh but yeah check him out all all the all the CSS stuff he he does over on his channel okay I have rotated my triangle I think I'm just going to use a uh translate X to get it in the right spot and then I'll do a Translate Y after that so I'm want to go that
way um let's do 30% okay and then we'll bring it down for a Translate Y of 30% pretty good probably 35% no it's probably 40% down it's probably 50% down yes it is I think that's it I think our the tops are lined up and then um is it a 50% to the right no 70 80 90
5% 100% uh that's closer I think maybe our our uh triangle isn't the right width and height but now we have to do less Translate
percent the translate X and Y do separately is like throwing things off I don't know why I mean it should be the same thing as this
right ah good call Sue Austin set a transform origin what is the like I guess the default transform origin is like the top left corner if we set the transform origin to Center that will probably be more predictable thank you for that yeah that's the way to go that's what I like look look at that so much easier okay uh 60 70 20 um
yeah America 2050 says my recommendation is always use pixels not percentage I think I'm going to have to cuz this this is like I adjust the Y and then it messes with the X and then I adjust the X and it messes with the Y cuz like technically I need to bring it down like a few percentages um yeah let's go with a pixel location like because we know the circle is 200 pixels wide so probably like 150 pixels in the X and then like 50 pixels in the
closer m so close do I need a bigger Square I think that's the issue is I don't know how big the square should be isn't there like a tool that can measure the width and height of a thing on your screen okay America 2050 says 110 and 20 oh it's so close look at this diff it's so actually looking at the diff will probably be easier 19 18 17 oh that's so close that's so close that's got to be it
right there's just like a slight Edge we we'll see the we might only get like 99% you think it'll give 100 okay America 2050 thinks we'll get 100% with that yeah uh n says is there any reason you prefer using percentage instead of using pixels uh no no reason only I think it uh I always go to percentages because it's a little bit more um responsive not always but like if you if the if the width and height were percentages and then the Transformers percentages then it could be relative according to percentages whereas like pixels are hard-coded in this case pixels make sense and also I don't know how how much of how if it's even a good practice to to uh size things with percentages in that way uh didn't CSS battle Implement some measuring tool I thought maybe that's just a plugin for like Chrome I don't know all
right we got that let's uh let's call this triangle one actually we'll do this we'll call it uh Tri we'll create another class called triangle 2 that just changes the uh transform
okay so up here we've got that triangle and then we need another triangle um I'm just going to make this black for now so that we can see
why can't I see it I guess I want this one to to start at the top left corner like the other position absolute top zero left zero because otherwise we're positioning it from being underneath the under the other div and then this will have position relative
um it has no width and height oh okay good call thank you Prav uh in the twitch chat um we need to give it the triangle class and the triangle 2
class yeah that's what that's what I would expect um so basically before it only had this but I wanted to have all of these and then we just override the transform cool thank you for that use pseudo elements oh that's probably okay we learned so last time last time on uh syntax bytes I learned about um box Shadow and this is basically like an offset box shadow of the other one using like after that is the way to go we don't need a element I can do this with a box Shadow pretty sure
um did I learn about box Shadows I think I did I'm pretty sure we use box Shadows for all kinds of things um I I have to look it up again because I don't remember how it all works um and Stefan con is saying pseudo elements would be better but it says shortest code wins so it might not be the shortest I guess if you do a pseudo oh you could say like before and then position it accordingly but wouldn't a box Shadow like have the exact same Shadow and then just we could offset it right so what are what are the uh the values it goes um length length length length
um two length Val what are the length values is it XY color and then uh type yeah offset X offset y blur radius spread radius so so um if we did something like uh five pixels x five pixels y black um that does nothing what happened to my triangle oh semicolon Yes okay uh so as you can see there's that little thing poking out there um tin no uh NE five yeah
okay I think we can go like - 20 or so let's try -30 and then bring the Y down did I do it no even more even more um
wow I've done it box Shadow is so easy man everybody should be using box shadow where has box Shadow been all my life look at this that's the one and then just make it red look at that uh it's not it's not quite right let's let's mess with the numbers a little bit so let's bring the X up a little bit like let's do 129 yeah and then if we do like negative 131 noga -30 has to be it hopefully this works I I hope it's not like 99% um yeah and JT says uh box Shadow Without blur seems like a pretty good solution it works out yeah it works out that's it we did it but let's see okay so now we're going to submit um to see if we did it here we go we're hoping for 100% yes yes we did it um sweet that that
wasn't that bad uh I think so so to get a higher score we got a a score of 601 to get it even higher you got to use less characters so uh remove all the extra spaces probably implement some variables so that way we're like not repeating things but this is my solution if anybody uh made your own solution for this uh throw a link in the twitch chat links don't work over on YouTube but if you head to Twitch you can paste a link there contr a shift tab wait what oh you're saying unindent everything yeah yeah yeah yeah unindent all of my codes and so right now my score is 61. 72 it'll be like slightly higher because I have less space
improve by three points sweet okay let's move on to the next one uh which is implementing the Iceland flag and oh you got the same cup what's up Stephan are you gonna be at J JS Nation us or did you did did you go to oh it's it's a little it's a little dirty or did you go to the uh uh JS Nation Amsterdam I got this at Amsterdam 2023 yeah nice what's up as bucket yeah the whole point is uh I mean the the CSS engine doesn't care about or css parser doesn't care about whites space um but the scoring mechanism for the site cares about white white space oh what did I call did I call you bucket sorry AES backet good to see you welcome in um okay my thought for this I just I'm just going to make a bunch of
divs like this is a square with border on the bottom and right uh a rectangle with a border on the left and and bottom uh and uh quick stretch oh the the only so uh mix nuts is mentioning you uh you would think they wouldn't care since the engine doesn't doesn't matter does either the whole point of the site is fewest number of characters it's basically code golf like you want they want you to write your code like this but even less like uh like people were saying using pseudo elements will actually get you even closer to uh less characters I see what you're saying though like they shouldn't care about whites space but but they do that's the whole the whole thing with like code golf is a thing and they they absolutely care about Whit space uh but the best solution is going to be all on one line and then your class names are probably
going to be single letter letters um if you are using class names like this like this you could probably throw this into a CSS minifier but that's only going to get you so far I think uh what really would do it is also like maybe these internal triangles actually could have been a pseudo element like before or after instead of a separate div and that would save you some characters too yeah is Razer page Razer Pages uh worth learning in 2024 it depends I mean there's a lot of like companies Enterprise companies that are probably still using Razer Pages um so razor pages is a net thing um and these days
um you you'll come across net apps that are are uh using MVC I guess do they can you use razor inside of
MVC or no they're separate they're separate and then these days you might even come across like newer apps that are using Blazer but um is it worth learning I think if you want to find a job at a company like that then probably yeah otherwise I personally wouldn't I think they they're better ways and easier ways to build websites I think I I don't know that's just that's just my opinion though all right let's build this thing uh like I said we're going to have a bunch of rectangles with various borders and then I'm just thinking we do two big old divs to make the cross let's make the cross first so let's set the background on the
again okay um now I'm going to make the Red Cross I guess technically um I was thinking if you did a Red Cross and it was the thing to have the uh White borders how how would you not have overlapping borders like right here huh might be learning avalonia UI is this the the WPF replacement yeah why why do you say why do you say uh pray for me uh the seems fine I think this was like the open- source modern replacement for Windows presentation Foundation seems fine I've never used it but it seems fine um keep the I mean razor pages is web dev like it's using CP and.net I don't I
don't mention I I don't mind taking a few seconds to talk about it but now I'm going to I'm going to lock in and I'm not going to second guess myself because I was thinking okay well if we if we did a just a red square red rectangle down the middle and gave it a white border that could work maybe maybe I'll just I'll just do that first let's create let's create ourselves like the the middle rectangle um we'll give it a height of 100 view height and then we'll make it this red color and then we'll give it a border uh let's say 10 pixels white solid white but we don't want that we only want the border on the left and the right uh what's the order
here how does border work four blue squares that's that's my that's where I'm going to go next yeah uh so my idea is um well so you're saying M just make the back oh you're completely right if we just make the background red and then make four blue squares we don't have to worry about about that it's kind of what I wanted to do anyways I'm going to do that that's my that's that sounds better to me so just make the whole thing red and then this these are going to be blue little blue divs with white borders um but how do we specify border on just like bottom and right
can you do it with the the uh this syntax or do you have to specifically do like left border like right border bottom
border um Stefan has it uh top right bottom left top right bottom left it's not working did I do this
top width right width bottom width left width border style solid and then color do I have a syntax
there I might just re reach for Border left and uh border bottom and border right I'm going to do that because I don't want to spend too much time on this um like that and then we can also do border bottom uh as the same thing all right I'm going to I'm going to clean this up a little bit I'm going to create some CSS variables um we're going to create a blue variable and that's going to be this
this uh I don't think you can do that you have to specify which side separate the Border width from the border color I see I okay but I'm going to do it this way this should be fine uh but now that I have that variable I could say VAR blue like that um and then the height we're going to bring it down a bit to 50 pixels 150 pixels 100 pixels 120 30 130 pixels 120 pixels and then uh the width is probably a little bit bigger as well it's pretty close um is it
130 125 and then our border um it's bigger than that 15 cool that's it look at us we've done it okay um I can put this into a variable as well let's just call this border
like that and then we've got a little bit less repetition challenge make it a grid that's what Stefan says I was I thought about that first I was like could you do this with CSS grid yeah I mean absolutely you could you could break this down into like this is one row with like one two 3 four five elements and then the next row is one two three elements and then just one element you could do it you definitely could do it am I going to do it no you definitely could um I'm going to call this one the top
left there's some suggestions um abdal Arman mentioned border color red border width ah so you can just do it separately I see I see grid template columns 30 pixels 50 pixels yeah you could like explicitly set each one um yeah just wanted to stop in and say hello how do you like your job I love I love syntax it's great I love working here uh I mean it gets it gets stressful but it's only stressful because I make it stressful like I spend too much time researching or spend too much time trying to or like being too much of a perfectionist about editing or uh anything stressful is what I bring on myself because the team is super chill yeah the videos I did when I had the hair on top of my head were really good and motivating thanks I mean hopefully
my current videos are still good and motivating but if you look back in the the history of of coding Garden I used to have have a a little top knot um like this 4 years
ago look at him he's he's got a little bun on his head okay um it is less code um I'm gonna leave it like this though wait where where did that come from okay cool uh so this is top left um the bottom
left um actually I want to make a Cass a class called left that has the height in it sorry yeah it's going to have the height and width because those can be shared with the top and bottom um and then top left looks like that and then um the border right can be the same for both of the ones on the left and the background is the same um but the bottom left we have a position of fixed and a Bott bottom of zero so that should put it in the bottom left corner and then we need to give it a border
color order top there we go okay left side done right side should be basically the same um so we're going to have another div we're going to call it uh top right and then our top right uh box Shadow instead of Border would be shorter to oh you're probably box Shadow for everything you're completely right um yeah like if we made so what yeah if we made them um what's 125 - 15 is 110 so if the boxes were 110 pixels and then the Box shadow
and how do we fill in this area right here huh like how do you make the the size of the Box Shadow bigger than the element any ideas I guess I guess we just set we just add another one we just add another box shadow um that doesn't have the X offset but it has the y y
offset um cuz top left X zero pixels why 15 pixels why that this is longer unless I'm not doing the Box Shadow right like if I have to do this for all the areas then this is going to be more code we're going to go back I'm gonna I'm gonna go back to what I was doing and just implement the right side because I'm basically almost done okay so our top right is going to need a uh we're going to make it position fixed and I'm I'm just going to make a top class here position fixed uh background
thing and uh we're going to say right Z so that's going to push it all the way to the right um with why did it change the other one oh cuz I called both of them uh wait we got left top left I need to call this
right okay um position fixed right zero and then width let's call it 300 pixels and height 110 pixels
220 225 uh and then uh top zero as well so it's at the top of the page there we go okay and then uh top right also has a border bottom look at that and then lastly we just need the bottom
right and uh it will have a uh bottom zero so top zero needs to be in the top right this is too easy and then border top here like that we've done it um when you use border you have to make the square bigger oh you're right okay um good call oh it should be the shouldn't be the same height as um oh my other one is off
okay M re is mentioning border is taking the space from the element just add 15 pixels I guess that's what we did but I I did it gradually without just doing the math um yeah okay we've done it let's
submit 100% sweet that was all right um I I would like to see it done with a border box or uh sorry back box shadow um but it did look like it was going to be more code maybe I wasn't think about it in the right way yeah I'd be if anybody implemented it with with grid I'd like to see it um yeah would moving the height to anything blue H they're all the same height oh you're right yeah that would that would save us some some codes because every single div um is 125 pixels High
now now we're just making art uh but if we say every div has a height of 120 oh no what did I
do I'm not going to change it I deleted the wrong line height 125 there we go height 125 yeah that's what we want to see okay now every div can have a height of
125 all right all right all right cool all right um next we're going to work on the syntax website so I'm going to take a quick five minute break um you should too if you've been sitting at home all day uh get up walk around a little bit get some water um and oh let me before that I want to look at how beine did it because they said they they did it without golfing but I'm very curious oh look at that the colors are off but that's okay oh so and the other thing is they used pugs if you haven't heard of pug pug is a templating language so this is equivalent to a div with four divs inside of it yeah that's funny hug life says uh says be mind um all right uh the grid oh grid template areas that's cool I like that a lot yeah okay so it's three columns and three
rows and then we have all of these areas so the cool thing about grid template areas is you can give it names so top left top right bottom left bottom right and then you can for each of the things you can tell it which area it should be and so you're basically basically explicitly saying go to this section go to that section that's a really cool way to do it so like this div goes to the top left this div uh goes to the bottom left um yeah that's really great nice solution yeah the colors are off but that's not what we're worried about they just they just use red and blue uh but they got the the sizing of everything correct yeah okay yeah five minute break when we come back we're going to work on the syntax website uh so one of the first issues it's a pretty simple one but on the homepage these three things here don't link anywhere uh but I want to turn them into links because we do have sections of the site that will actually filter down to just show you the Hasty treats the tasty treats and the Supper Club um and then another fun one is
we're going to implement some structured data so each of the podcast pages right now doesn't have any embedded structured data but we're going to embed this Json LD that has all the information about each podcast episode okay that's the plan I'll see you in five minutes
all right we are back and if you're just joining us we are now going to work on the syntax website so syntax. FM is our website it has all of our podcast Epis EP as well as uh most of the the videos that I've been putting up and Scott has been putting up on the channel um but it is open source so if you go to github.com syntax FM website you can pull the code down run it locally if you'd like to um and if you come across an issue you can open an issue so we have issues here this one was opened up by uh to toin or ton um and they mention that on the homepage we have these uh three sections here uh but they're not clickable like it would be nice if you could click in and then filter to all the episodes that are Hasty treats or tasty treats or supper club um and so uh Scott did mention that you actually can filter when you're on the all episodes page so basically all I'm going to do is add make turn these into links so that way when you click on them it goes to
the filtered page it should be pretty simple uh but let's get it going so uh locally I'm going to go into site check out the main branch main uh pull all the
latest whoa oh okay I think I was like what changed here um there's some image optimization that I think Scott added in or some someone added in um that changed a lot of our image files that's cool um nothing done nothing uh pending locally and I'm going to spin up the database and the reddis so the postgress database and the redis or no the mySQL database and the reddis database and we you can do that with Docker compos app so we have a Docker file in the uh repo that starts up a redus database well actually it starts up a reddis HTTP server so that way it's compatible with uh up stash because when we're deployed we're talking to up stash and then it also spins up a MySQL server so um whenever you then spin up the app with pnpm runev uh this will connect to that mySQL
database and that redest database here we go website is preheated does it work it works cool so this is the site running locally on my machine um and we're not going to do any more CSS battles today yeah that's it for today uh what's up Evolution desuka says you got me finally picking up view with your vids good stuff nice love toar hear it I like view a whole lot so I'm glad glad glad you're using it yeah no more CSS battles for today if if these interest you check out the previous live streams um there's a playlist on the channel here if you go to playlist there is the syntax bite playlist and um yeah two other episodes I actually worked on CSS battles so you can check those out and we're going to do more in the future um and the live stream will be more of a reg a regular thing um probably starting in like December maybe even the well I was going
to say last week of this month but holidays but probably starting uh in January we're going to I'm going to start live streaming uh twice a month on every every other Friday uh so you'll see a whole lot more of Me Okay so the site's running locally let's make these things link um and the uh first we should just open up the code open open up the uh this folder in vs code and uh if you're ever in a brand new code base and you need to go fix something you've been assigned a task probably the easiest way or one of the one of the ways to start and just find where is this where can I find this right here is to just do a plain text search across the code base um now it's very likely that this is on the homepage and so if you know anything about belt kit you could look in here and be like okay it's probably in
Source um it's probably in routes but then where do I go is it on site maybe it's on site and then maybe it's on site it's in the page dosf that's my guess and then there's like a podcast hero component and I'm guessing it's actually inside of the podcast hero component um because there's that oh maybe
not could be a component regardless even I who has worked in this code base before uh don't know doesn't don't know where it is but here's what I'm going to do I'm just going to literally search the whole code base for uh that specific piece of of text and just see where it pops up so command shift F this and then uh there's a schedule component would you look at that so in Source there's a lot of code in this code base but in Source lib uh there is a component called schedule.
spelt and this is it easy and so this is this div is the Hasty treat then we have the tasty treat so I'm literally going to turn this entire thing into a link um yeah I think the main thing is if I if I just wrap this in a link we're probably going to get some weird styling let's see if so I'm just going to override that styling are you not supposed to have P tags inside of a oh okay that's fine needs an
HF let's see turning these into links could make them ugly it doesn't awesome so uh this is this is going to be so easy to fix because what we need to do is if we go to all the shows and then filter by type uh like Hasty you can see that the URL should just be shows type Hasty easy that and then this will be for tasty we can confirm yeah type is
tasty uh abdal Arman is asking what are we using for styling it's all just custom CSS um they yeah we're not using Tailwind or anything like that just a bunch of
CSS oh that's good to know America 2050 says I believe spelt has a browser extension that will link you to visual studio code and open the file where the piece of code lives that's awesome um is there a like spelt Dev tools I'm curious if if there are spelt Dev tools do they have support for uh spelt version 5 because this site is being built with spelt version 5 browser expens extension to inspect spelt application by extending your browser's Dev tool capabilities
um how do I install it do I have to download it and build it it's in the Chrome web store but it is is it in the Firefox web
same I thought I saw red Hatter somewhere yeah this extension was initially created and developed by Red header when was this last updated though is this up to date four years ago they need they need a build for Firefox well no no extension for me because because I'm using Firefox okay and then we can uh filter by Supper Club and the type is
supper all right that's should do it done that's my that's that's my work for the day okay so now these are nice and uh clickable and that takes you to Hasty treats and tasty treats and the Seer Club heck yeah uh no no chat gbt no I mean I'm a I'm a real developer I know how to do this without co-pilot or chat GPT so uh so I did okay that's that was super easy and uh we can feel good about our about ourselves because we got some work done so I'm going to check out a branch um we're going to call this fix what's the issue number uh
Branch uh do you always work on Main and then create a branch for those changes uh create a branch as early as possible I forgot to but but you should usually when you start working on something create the branch first just so you so you don't forget but yeah um okay so we push that up I'm going to make a PR now and then I'll also reference number 1889 so that way whenever the pr is merged it'll autoc close this issue new pool request adds links to all the show Types on the homepage FES number 1889 9
cool we'll request Wes and also Scott to review wait did did versell deploy it that quickly oh it's building okay I was about to say it's like there's no way um awesome okay uh next up let's work on this Implement structured data for each podcast so the idea is that when you go to a specific show like this one um the source of this page should have a script application LD Json in it that has all of the show metadata um and currently they do not and um it should be pretty easy because we
have all of this info loaded from the database um so yeah should be pretty easy uh it's part of it's part of the HTML so a lot of uh search engines that have like little card embeds um or when you share a link on a website if your site has this stuff in it um it's actually going to pull from that so it's inside the HTML itself yeah I mean uh I'm curious what websites Do It um a lot of uh recipe websites actually have this uh I know this cuz I was making like a recipe scraper website um but yes so a lot of websites will'll have recipes but then there'll be like a whole blog post before you even get to the recipe but to be more searchable and indexable they have this application LD and then the type is recipe so schema.org has all kinds of schemas let's see if the if we can find the uh recipe
schema yeah and so there's a schema for recipe which uh has all of the things that you would want to know like ingredients and nutrition and prep time um but it's in a structured format um there's another issue on the the repo um that has to do with adding information about the the hosts and the and the guests so there's a a schema called profile like yeah there's a person schema and a profile schema and so on the site um if we go to an episode that has a guest like this one this page could actually have the uh profile schema embedded in it so that way um if this page shows up in a search engine it's going to have all the info about uh Taylor including like their link out to uh social media and stuff like that so yeah so yeah it's it's part of the HTML um so Google can show when they have 4.5 stars or difficulty level and things yeah so any any place that needs to show
metadata about a website tries to at least find that information in application LD Json first um you can see there's other ways to do it though as in um yeah there's this Micro Data type this a lot of websites have this too which makes them pretty easy to scrape if they're using like item scope item scope and item prop Um this can just be in the HTML itself but it uses these these structured props so that it's easily parsable um yeah and then there's this and then this is just the schema itself yeah that's a thing okay okay um let's check out a different branch first I'll check out Maine pull from Maine just in case anything changed and then we'll check
1257 okay so this should specifically be on the show page page itself and if we look at uh site show show
number or slug oh show number slug uh layout I think we can put it in the layout because spelt has a specific head component let's see
um and then we can just specify that it should show up in the head yeah here's a header no that's not the head that's the header I'm going to need to look this up because I think it's slightly different in spel 5 um that spel kit um head special elements spelt colon head this element makes it possible to insert elements into the document head during serers side rendering this is what we want yeah just this um and does the layout have access to the sh when this page gets rendered it should I think it would have already loaded all of the the show metadata like the name the MP3 URL all that stuff so we should have access to that in layout. spelt
um so let's see if we look in layout. server this is the code that runs on the server that's actually talk that actually talks to the database so um yeah and we do some caching so basically pull the show from the cache or from the database if it wasn't in the cache and this has guests hosts all our AI show notes and then all the info about it so we should have access to the show inside of our layout. spelt so this file layout. server runs on the server to get all of the data and then it renders layout. spelt on the server which in turn renders the page which is loaded within that layout um and so right here data. show I think should have all the info that we need
and so I'm going to throw a spelt head right here that adds a script type LD Json for now I'll just leave this hardcoded um to see if it actually shows
up oh and I'm going to enable uh es link cuz I had it disabled because I've been working with Dino so much uh so let's dis disable the dino extension enable es lint I think I think we have a prettier config we might have switched fully to es lint I know there were a lot of changes that happened there recently accidentally closed my editor okay um so now es lint fix all autof fixable problems let me see do we have a prettier RC yeah we do okay so I can run uh prettier there we go okay so that got added to the Head now if I go to a specific show and I look at the source for
Json we don't yeah oh I mean this site has been a long around for a long time since I'm such a huge drizzle fan I'm a fan of both um I I like these days if I'm making a new project I'm going to choose drizzle uh just because I really like the the types the type integration uh was it slash or minus application LD plus Json this is what it should be oh you know what I bet it's in the cache oh no there it is okay um so there's that script element and then there's all the data cool cool uh so now we just need to fill it in um can I do I get ah
like I almost need to like dynamically generate even the script tag and then insert that into the head let's look at their docks um spell docs to see if they have an example of that I don't want the example I want the
dots uh this element may only appear at the top level and must never be inside a block or an
element during server rendering the head content is exposed separately to the main body component okay I'm just going to search the web uh spelt head um access
props how can I access a component prop from a parent inside a script tag no I don't think that's what I want yeah what's up osar good to see you um like normal spell I mean if there's a way to do it in in spelt spelt head render Dynamic script tag how to set a dynamic HTM tag according to
props um I mean I could just try it I could literally just try like at HTML it's I'm not getting syntax highlighting right there so I don't think it's going to work
I I don't think I can do this huh we got any spelt people in the chat anybody know how to use spelt where's uh where's Paulo when you need him Pablo um oh and thanks thanks uh ABD Aran and what's up pral watching your last Denver walking stream good to catch this live stream oh yeah glad to hear it yeah I've done some IRL streams over on the coding Garden channel channel um I guess I'll just try to render the page but it looks like this isn't going to work because the uh maybe I need a script in the module scope but variables defined here don't look like they're accessible inside of spelt head let's try it though yeah uh Iden oh let's call it something else
another yeah see it just renders it just sends it directly h H um what does a programmer do when they don't know how to figure something out yeah um I we will we will very likely go over to an AI tool if I can't find a solution soon yeah so this is yeah they're trying to do it they're trying to do it exactly like this this should tell us how uh you may need to preserve LD Json tags in a spelt pre-process this is from 2021 though
shows up in HTML code exactly as written in the head tag um the only form that works seems to work as of this is the at HTML injection method
so you can just access a variable like this that's what this is saying some Json this is from 2019 though this might have changed in the more recent versions this is the correct way to do it
oh oh that makes sense okay don't put it in the script tag just L literally render it out like this okay yeah this is the way this is the way um okay which means oh oh yeah like that oh moment yeah okay that makes sense yeah that makes total sense like if you want to access things don't put it in a nested script tag just do it out here this is the way okay so let's call this the uh what do we want to call this schema show schema
though and with uh formatting look at that okay now we just got to put the actual data into it so uh URL is going to be this specific URL how do we get access to that inside of um the felt layout is it something to do with like navigation
appnation spelt kit get current URL take me to a blog post page is this going to work in the layout is this going to work in Sp
great that looks good to me so yeah and when it's deployed it'll be the like the production URL all right everybody we're doing it we're doing it um now we just got to fill everything else in so the name is just going to be show do title the date published why is this complaining State referenced in its own scope will never update did you mean to reference it inside a closure um this derived though this should be fine because it's running on the
server uh date published probably needs to be in this format we can look at the schema uh be a date the iso 8601 date format which is year Dash month- day do we have a date parsing Library um but there is a created at field
here yeah we don't want this I guess this is year month date I guess if we if we split on capital t is that going to work also that I guess that would be UTC time we got we got to use a date formatter I'm going to see if we have any
format show do date it's already a date yeah it's already a date thing so we want um year year year Dash year year year year Dash um month Dash um I got to go look at the date functions
format format the date they should give us a table Yeah we want the um month Standalone yeah l l capital L capital l and then the day of the month is going to be DD all right that should do it nice all right time required this is specifically a duration format I don't know if we use that anywhere in the app I'm going to skip that for now
that should be it though I'm going to I'm going to assume that that's that that's it because when you look on the the syntax website um these little descriptions right here these are coming from Ai and that's what we want I believe though what is what is this one see what that one is are those just embedded in the the show
H I'm pretty sure this is this is the description that we want or do we want summary we want description okay um and then the MP3 URL where do we find that show dot um
URL download the episode showed. URL yeah that's it part of a series the podcast series the name of the series is uh syntax and the URL is syntax.
okay awesome that is the MP3 last thing is we need uh to do a duration formatting um I don't know if there's anything in the code base doing anything like this PT search for like
duration actually I guess I'm curious in the RSS feed Does it include a duration format like that let's see
oh you know what I don't think we know what the duration is I think there's an issue open right now that we we don't have like the embedded show
duration yeah add episode duration to the DB episode duration isn't something we've saved it would need to be calculated at import am I going to have to calculate I mean I don't know if it's required I think we can actually leave it
required yeah we're going to have to leave it off for for now um but I'm going to add this as a to-do just like in the object
the this warning State referenced locally I guess let me make sure my spell extension is up to date
loads and here's all the metadata cool I think this is enough um at least for um for now but once we get the duration we can add that in later but this is this should be all we need let's of course we'll just test a few other Pages um let's actually go way back like what happens if we choose like show number five or something like that show number one react tools um and yeah so here's the URL the date the name MP3 yeah um America 2050 says shouldn't it be syntax. fmsh shows um oh because
that's yeah you're probably right but no I think just linking to the the site itself for now like we we are working on a complete like rework of the site to integrate more like video and all of the other stuff that we do So eventually there will be a dedicated page for the podcast right now the site is kind of like the podcast page so I think I think that's good good enough for
uh SQL gster is asking uh is the new info being wrapped in the script tag um it should be so basically the the starting script tag is on the previous line and the closing script tag is on the next line that's what I was assuming Let's uh let me show
you yeah so the script starts right here and then the data starts on the next line and then the script ends like
just curious what are your thoughts on testing with playright I think it's fine I think both of the imple both of the features that I implemented today are so simple that I it doesn't feel like I need a test for it but um um yeah we've had so over on the coding Garden working on some sites and like adding uh what was it Cypress test testing or do we ended up doing when did we do playright um it took a lot especially when you have like your database running inside of Docker and then you maybe you want to spin up a test database so that when your playright tests are running they're running against the test database it's it's quite a bit of a conf of configuration just to just to get all of that going so um I think major features should be tested but stuff like this should be fine should be fine
1257 awesome I'll add Scott and Wes as reviewers and um we can test out the previous feature by going to the preview deploy let's do that actually uh link show Types on the homepage we it failed why did it fail the playright test failed we we've had some issues with our playwright tests like potentially like could connecting to the wrong database um or the database not
process from config web server was not able to start segmentation fault cord so yeah our tests aren't running right now for whatever reason but well if we look at the preview deploy this particular feature was all about uh adding links on the homepage the unexpected curly brace uh had to do with some CSS code that is correct but I think it's too new for the parser to understand yeah these should Now link to the correct show type which it does cool and then uh we'll wait for our other one to deploy click on it sure yeah so this one already
deployed and so if we hit a site and then look at at the source there it is look at that it's nice and the code is all minified and stuff cuz we're not running in Dev mode anymore but the data is embedded sweet all right that is all I'm going to do today we got two things done the tests aren't passing but that's okay um we still got some stuff done I was recently working on writing some tests and to me they kind of feel redundant at times however one can definitely learn a lot when writing tests generally if the flow is too big yeah I think this is the biggest issue that I have with tests is a lot of times we end up testing the underlying libraries right so like we're using a framework or we're using a library and it was written to do a specific thing uh and it's already tested itself so when we write tests it just test to make sure that it does the thing that it was
supposed to do and that's what it's supposed to do I think those those are wasted tests uh but when you have custom implementation that's uh outside the realm of using some particular library or framework that make to me makes sense to have test for B of you to assume that libraries have tests most most of most of them do a lot of them don't you're right but yeah um if you have FF probe you can do FF probe V quiet print format Json show format
oh are you talking about getting the episode duration is that what you're talking about Stony Eagle because uh yeah we we want to do that eventually I think the main thing is um yeah because we we have that issue for it but uh I feel like it it would have to be some kind of external task maybe we could do it like in a GitHub action because it is running on versel I don't think the versel environment would have access to FF probe we would need to use maybe like uh the like aasm version of it or something like that
yeah okay that's all for today thank you everybody for hanging out yeah um yeah and what's up uh Lucas uh what are you doing Json LD yeah so uh we just implemented this on the syntax website um where now when you you go to a specific episode page it's actually going to return that that Json LD data it's a pretty simple fix because we already already have all of that metadata like the title the date the description the MP3 URL so we literally just make that object and then throw it into the the head like that so yeah all right but that's it for this episode of syntax bites thanks everybody for hanging out thank you for all of your comments and insights um we're going to do this again but the holidays are happening so you'll probably see me uh maybe maybe you'll see me in December probably I hope I'll I'll hope on doing a live stream here on the
syntax channel in December yeah so potentially let's say like December 5th or December 12th or December 6 or December 13th we'll see but sometime in the first two weeks of December you'll see me on live stream yeah see you later Stefan um and everybody else thank you for tuning in the holidays yeah there's Thanksgiving and then there's Christmas yeah a daily stream I'd like to I just I'm working on so many other videos though make the CSS battles more frequent well eventually what we want to do is also like potentially get some make it a little bit more interactive like maybe we have Scott on and we're actually battling like we're both like maybe you can see both of our screens and we're both trying to solve it as fast as possible or maybe there's a time limit but who can ever whoever can get
it in the shortest number of characters within the time limit something like that it could it could be super super fun super interesting we're gon to we're going to experiment okay that's all I got again thank you for tuning in and uh we'll see you soon if you if you're here and you haven't subscribed or liked this video please do yeah that's it we'll see you next time
and uh stick around for the raid if you're watching on Twitch we're going to find a channel to raid uh if you're watching on YouTube head over to twitch.tv/ sytax FM and join us in the raid
Quote it with credit and a link. Quoting Syntax