Published at
Updated at
Reading time
9min
The Web Weekly newsletter keeps you up to date, teaches you web development tricks and covers all things working in tech.

Guten Tag! Guten Tag! ๐Ÿ‘‹

Do you know that CSS ifs are shipping in Chromium? Have you ever used import.meta.resolve? And did you celebrate that we can finally import JSON files in all browsers? (I surely did!)

Turn on the Web Weekly tune and find some answers below. Enjoy!

Pawel listens to Quantic - The 5th Exotic:

This track is just as good as the rest of the album. It features elements of breakbeats and jazz, is super melodic, and super dance-triggering (much like the entire album).

Do you want to share your favorite song with the Web Weekly community? Hit reply; there are four more songs left in the queue.

Do you know people saying that CSS isn't a programming language? The world is changing, people! if/else statements are entering CSS. I mean, maybe they do, because they're a Chromium-only thing right now... But let's be optimistic and celebrate all this CSS programming!

Let me show you an example. ๐Ÿ‘‡

Two CSS snippets. One uses @media queries and the other one uses if(media()).

You know that if you want to style elements differently on the viewport you have to wrap everything in a @media query. You can now do this inline, with if(media(/* ... */)). This seems like a handy way to overwrite a single property. For complete rewrites, I'll probably stick with good old media queries.

However, the cool thing about CSS if is that it works with style queries (style()), media queries (media()) and supports queries (supports()). And I can totally see that this could be useful.

h1 {   font-size: if(     media(width >= 1200px): 3rem;     media(width >= 768px): 2.5rem;     else: 2rem   ); }

And granted, I could also see myself controlling CSS custom properties for some custom theming.

--background: if(     style(--theme: "Shamrock"): var(--shamrock);     style(--theme: "Saffron"): var(--saffron);     style(--theme: "Amethyst"): var(--amethyst)   );

Now, CSS if isn't ready to use yet, but if you want to learn more about the future, check these three posts:

If you enjoy Web Weekly, share it with your friends and family.

A quick "repost" really helps this indie newsletter out. Thank you! โค๏ธ

Something that made me smile this week

How punctual are you?

This really made me smile.

Check the time

And no, I wasn't very punctual (even though, I'm German)...

No code

Add notes to your component styles

:has(> .sidebar) > :only-child, :has(> .sidebar) > :nth-child(3) {   outline: var(--error-outline); 	--error: 'Sidebar layouts must include exactly two child elements.'; }

Here's Heydon musing about some flex box magic and :has() selector performance. It's a good read. However, every time I see him using custom properties to "hide" notes and error messages, I can only stand up and say "Chapeau, my friend!". This approach is very smart to self-document CSS code.

Write clever CSS

Improve your regex skills

Tips for making regular expressions easier to use in JavaScript

I know that regular expressions aren't everybody's cup of tea, but this post from Dr. Axel includes so many small tips and tricks (did you know about the v flag?) that you should check it out!

Express yourself!

On using popovers for hover interactions

HTML snippet including a new `interestfor` attribute

Did you realize that the native HTML popover has been working across browsers for over a year now?

I used it two weeks ago and felt like a cutting edge warrior, but I guess it's time to put popover into the mainstream.

However, it's not possible yet to use declarative popovers for hover interactions but there are things in the making. Una shares some approaches for building these preview hover cards.

Pop over!

Nuxt joins Vercel

NuxtLabs joins Vercel

I really don't know how I feel about Vercel acquiring Nuxt (Nuxt is the Next.js of the Vue ecosystem), because the hosting provider puts more and more core web tech parts under their wings. A growing monopoly doesn't seem to be a good thing to me.

VC money, by nature, doesn't care about the web, open source, or communities. Let's set an alarm in two years to see how all this turned out.

Read the announcement

You're halfway through!

Wowza! Would you enjoy getting Web Weekly straight to your inbox?

The wonderful weird web

No days off โ€” running everyday since July 11, 2015

There's this guy, Adrian, who decided to go running every day. Great for him, right? He must be in good shape. What's the next logical step when you go out for a run daily?

Correct! You buy nodaysoff.run, build a website and keep track of your running data. I love everything about this.

Is he still running?

Prompt injection remains an unsolved problem

An email with "invisible" text (white text on white background) which leads to this invisible text become visible in Gmail's "Summarize email" feature.

I don't talk much about AI here in Web Weekly, because I'm simply too scared and frustrated by the current state of the web (and world).

However, it's mind bending to me that the problem of prompt injection is still unsolved and even flagship products like Gmail fail to secure their AI features from "hidden instructions."

Especially now, that everything needs to be agentic, I really wonder when we'll see the first catastrophic failure or fuck-up caused by "untrusted third-party text." We really can't be far off...

Don't trust

gif-like SVGs

The moving image below is only 49kb and has an incredibly high resultion.

For the folks working towards great READMEs: if you want to show off terminal commands or moving command line examples, svg-term lets you create SVGs that feel like videos.

Create moving gifs

Are these grid columns the same? ๐Ÿ‘‡

.grid {   display: grid;    grid-template-columns: 1fr  1fr;   grid-template-columns: 50%  50%;   grid-template-columns: auto auto; }

Chris has all the answers if you're unsure.

Understand grid

Random MDN โ€“ import.meta.resolve

// Script at https://example.com/main.js  const helperPath = import.meta.resolve("./lib/helper.js"); console.log(helperPath); // "https://example.com/lib/helper.js"

From the unlimited MDN knowledge archive...

Did you know that you can build up absolute URLs using import.meta.resolve? I for sure, didn't.

Resolve

TIL recap โ€“ fn.length and the rest operator

function myFunc1 (a, ...b) { } function myFunc2 (a, b, c, ...d) { } function myFunc3 (...d) { }  console.log(myFunc1.length); // 1 console.log(myFunc2.length); // 3 console.log(myFunc3.length); // 0

Maybe you know that you can call length on JavaScript functions, but have you ever asked yourself what happens with length when you use the rest operator (...rest) or default values?

Yeah... you probably have not, but you can find some JS trivia on the blog.

Know the length

Find more short web development learnings in my "Today I learned" section.

New'ish on the baseline โ€” Import attributes

import data from "./data.json" with { type: "json" };

On the baseline since April; all browsers let us import JSON files. It was about time, wasn't it? Sometimes it's the little things that spark joy, right?

Import JSON

Classifieds & friends

I don't remember when I signed up for CSS Weekly, but I must have been reading Zoran's emails for over ten years by now. And he's still at it, sharing weekly CSS news. So, if you need even more CSS content in your life, you should check it out!

Three valuable projects to have a look at

A new Tiny Helper

Example showing how a string with ANSI control characters is transformed into styled terminal text.

If you've ever been in the situation of debugging terminal strings, CLI styling and ANSI control codes, you probably would have wished to know ANSI.tools.

Debug terminal styles

Find more single-purpose online tools on tiny-helpers.dev.

Thought of the week

Let's close this Web Weekly, with some ๐ŸŒถ๏ธ from Manuel...

Using client-side rendering for a regular non-application like website is a sign of incompetence because you don't know what's best for your users.

Did you learn something from this issue?

โค๏ธ If so, join 24 other Web Weekly supporters and give back with a small monthly donation on Patreon or GitHub Sponsors.

This is all, friends!

Loved this email? Hated this email? I want to hear about it!

If you think something needs improvement or something sparked some joy, reply to this email because I want to know more!

And with that, take care of yourself - mentally, physically, and emotionally.

I'll see you next week! ๐Ÿ‘‹

If you enjoyed this article...

Join 6.1k readers and learn something new every week with Web Weekly.

Web Weekly โ€” Your friendly Web Dev newsletter
Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles