MoreRSS

site iconBryce Wray

Based in the Dallas/Fort Worth area in Texas, U.S.A., I’m a nerdy advocate for static websites and the tools that build them — particularly Eleventy and Hugo.
Please copy the RSS to your reader, or quickly subscribe to:

Inoreader Feedly Follow Feedbin Local Reader

Rss preview of Blog of Bryce Wray

Sass mixed declarations change

2024-11-19 06:15:00

If you upgrade to Dart Sass 1.77.7+, you may need to move around some nested items in your styling.


In recent months, I’ve settled on keeping this Hugo-based website’s styling on a combination of vanilla CSS and, in production only, PostCSS. However, I still have code that allows me to use Sass if desired; so, out of curiosity I thought I’d see how it’s doing with newer versions of Dart Sass, to which I keep my repo updated. Turned out I had to make a number of changes, specifically due to a fairly recent change in Dart Sass.

I had missed the fact that, as of Dart Sass v.1.77.7 (the release of which apparently dates from sometime between 2024-06-11 and 2024-07-11), one has to be more careful about the placement of nested items. The following worked fine prior to that version:

.example {
 color: red;

 a {
 font-weight: bold;
 }

 font-weight: normal;
}

However, since then, such SCSS would trigger a deprecation warning and, in the case of using Embedded Dart Sass with Hugo, cause Hugo to crash. The emitted warnings pointed me to the Sass page “Breaking Change: Mixed Declarations,” which explained why the newer Sass versions no longer accept this styling and, borrowing from the example above, require it to be like this:

.example {
 color: red;

 a {
 font-weight: bold;
 }

 & {
 font-weight: normal;
 }
}

In my own case, I had various media queries scattered about, and fixing them proved to be slightly more challenging. Here is a simplified version of such SCSS, which was fine in the older versions but not post-v.1.77.7:

.example {
 font-family: sans-serif;
 @media (min-width: 720px) {
 font-family: serif;
 }
 color: #000;
}

. . . and its newly required replacement:

.example {
 font-family: sans-serif;
 color: #000;
 @media (min-width: 720px) {
 font-family: serif;
 }
}

While I could also have gone the & {} route with the color statement, as suggested by that Sass deprecation documentation, my actual affected SCSS in most cases was sufficiently snarled up that I found it easier just to move media queries to the end of each declaration. I was fortunate that this sort of fix, although I had to make it in quite a few files (since I split up my styling for organization’s sake), apparently solved all my violations of the newer Sass version.

Thus, if you’re a Hugo/Sass user who hasn’t upgraded Embedded Dart Sass recently, you might want to make time for testing your existing SCSS with a post-v.1.77.7 version.

Reply via email

A simple Hugo shortcode for embedding Bluesky posts

2024-11-14 02:45:00

While it doesn’t do static embeds, this shortcode gives you an easy way to show content from an increasingly popular social network.


The Bluesky social media network, initially hampered by a wait-for-your-invite policy while capacity was being enhanced, recently has hit a growth spurt. Bluesky is now getting increasing attention from not only individual users but also a variety of larger entities, including a number of major sites which have been leaving Twitter/X for hoped-to-be-greener pastures. This post gives you a simple Hugo shortcode for embedding Bluesky posts in your content.

I shamelessly based this shortcode, called bluesky, on Hugo’s existing twitter shortcode for embedding Twitter/X content through the oEmbed protocol, which Bluesky also uses. Please note:

  • Bluesky’s use of oEmbed is somewhat more limited than what works with Hugo’s twitter. This document explains what Bluesky’s oEmbed endpoint recognizes.
  • This is not a static embed, such as those about which I originally wrote in 2022 regarding content from Twitter (before I had to deprecate my articles on the subject due to Twitter’s later closing off the applicable API) and Mastodon. Fortunately, at least as of this writing, there apparently is no tracking code within what this embed downloads to a browser. The embed does, however, require JavaScript to look normal.1

Using the bluesky shortcode

The bluesky shortcode takes only one parameter: link for the URL of the Bluesky post you want to embed. Here is an example of the bluesky shortcode in use2:

{{< bluesky link="https://bsky.app/profile/bsky.app/post/3latotljnec2h" >}}

. . . which produces the following:

15M people on Bluesky!!! 💫 The Verge beat us to our own announcement — that's the beauty of an open network with public stats!

Bluesky (@bsky.app) 2024-11-13T15:43:47.612Z

The code

bluesky.html

{{- $link := .Get "link" -}}
{{- $query := querify "url" $link -}}
{{- $request := printf "https://embed.bsky.app/oembed?%s" $query -}}

{{- $jsonOembed := resources.GetRemote $request -}}
{{- $jsonOembed = $jsonOembed | transform.Unmarshal -}}
{{- $jsonOHTML := $jsonOembed.html -}}
{{- $jsonOHTML | safeHTML -}}

  1. If the embed appears without JavaScript running, you’ll see a bare-bones, text-only representation which, actually, is very similar to how the Hugo twitter shortcode handles tweets if you have Hugo’s privacy settings set appropriately — and, in fact, that may be preferable to those who are likely to disable JavaScript in their browsers. ↩︎

  2. If you happen upon this site’s repo out of curiosity and check out this post’s Markdown file, you’ll notice that this example’s curly-bracketed boundaries also have wrapping /* and */, respectively. That’s because, otherwise, Hugo sees it as real code, not just a representation of it, and acts accordingly — in this case, once again displaying the image. See “Highlight Hugo/GO Template Code” in the Hugo documentation. ↩︎

Reply via email

Eleventy 3.0 debuts

2024-10-03 00:07:00

The latest major version of the best JS-based SSG brings quite a few enhancements.


Version 3.0 of Eleventy, which I’ve long considered the best JavaScript-based static site generator (SSG), has emerged from testing. Eleventy creator Zach Leatherman issued the v.3.0 release yesterday. This new major version comes with a lot to offer, regardless of whether one’s site is already on Eleventy, but there are things for which to watch out as well.

I haven’t tried Eleventy 3.0 since its alpha-test period, so you’re much more likely to get good information about this new version from other bloggers who are using it actively. Also, there’s no point in my reiterating everything in Leatherman’s release announcement, so let’s just say that v.3.0’s most notable raison d’être is adding support for ES Modules (ESM) while retaining legacy support for CommonJS. As the JS world shifts more and more toward ESM for the countless packages in its orbit, this long-awaited enhancement removes what had been a drawback for using Eleventy with many items. Of course, v.3.0 has many other goodies (and, yes, breaking changes for sites using older Eleventy versions), so be sure to read — and heed — the full release announcement.

After bouncing around over the last couple of years between self-supported status and corporate sponsorships that turned out to be all too temporary, the Eleventy project recently became part of Font Awesome. It’s a transition which, one hopes, will firmly bolster the long-term stability of this justly popular SSG.

Reply via email

1Password adds script

2024-09-15 01:54:00

If you count your JavaScript load, be aware of this recent change to the 1Password browser extension.


In much the same way as I previously decided to advise of a Bitwarden script that could inflate your JavaScript load, I’m passing along some word of what I assume is a recent change to the 1Password browser extension.

Here’s what I posted on social media earlier about this:

The @1password browser extension adds `injected.js` (674 Kb) to each page.

If you use this extension and are trying to measure your pages’ download size, be sure to filter out this script by name in the Inspector view of your preferred browser **or** just use Inspector within a private/“incognito” tab/window.

Reply via email

Getting one in for August

2024-08-31 01:47:00

Why I decided to issue this short one.


The title pretty well says it all: I am issuing this post only to get one in for August. That’s because, otherwise, I’d have failed to do a new post during an entire calendar month for the first time since the site went live nearly six years ago. Didn’t wanna do that.

Why has my writing output declined so much in recent weeks? It’s fairly simple, actually. Recovery from my second major surgery in a four-month period is ongoing (and going well, I should add). At least partly because of that, I haven’t been as “plugged into” my usual sources of inspiration for writing new pieces.

This, too, shall pass, as it’s been said.

In the meantime, I didn’t want to let August pass without putting up at least one post, however trivial such a motive is. So here is that post. Thanks for reading.

Reply via email