惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Visual Studio Blog
I
InfoQ
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
D
Docker
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
量子位
D
DataBreaches.Net
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
T
Tailwind CSS Blog
S
Securelist
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
雷峰网
雷峰网
D
Darknet – Hacking Tools, Hacker News & Cyber Security
小众软件
小众软件
Cloudbric
Cloudbric
N
News and Events Feed by Topic
L
LangChain Blog
云风的 BLOG
云风的 BLOG
S
SegmentFault 最新的问题
L
LINUX DO - 热门话题
T
The Blog of Author Tim Ferriss
AWS News Blog
AWS News Blog
爱范儿
爱范儿
博客园 - 聂微东
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
PCI Perspectives
PCI Perspectives
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
Y
Y Combinator Blog
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
AI
AI
The Last Watchdog
The Last Watchdog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CXSECURITY Database RSS Feed - CXSecurity.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
美团技术团队
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
T
Tor Project blog

CloudCannon Blog

Building with AI: Git-based vs headless vs traditional CMS CloudCannon + Astro: performance meets powerful content management Introducing the Astro Component Starter Introducing Jetstream — built on the Astro Component Starter Why we switched to the system font stack Redesigning CloudCannon’s docs with Diátaxis, Lume, and Pagefind Make content editing more visual: upgraded Editable Regions How Configuration Mode makes building editing interfaces easy Your hosting just got an upgrade (and a price cut) Custom testing domains for professional branding Keep your content consistent with input validation Managing multilingual content in CloudCannon Simplify team publishing with conflict resolution and domain tools Open Beta: Publishing Conflict Resolution Getting started with CloudCannon and Astro: Bookshop, components, and live editing Welcome to the CloudCannon Community! Omnichannel delivery is just marketing spin from API-based CMS companies Getting started with CloudCannon and Astro: Snippets and Collections Managing digital assets in CloudCannon: a guide to smart asset storage Understanding CloudCannon's branching workflows and Projects: a complete guide What is a static website? CloudCannon’s 2024 wrapped Getting started with CloudCannon and Astro: WYSIWYG blogging Jamstack vs. WordPress: reasons to make the change The top five static site generators for 2025 (and when to use them!) Free Jekyll themes for 2025: ten great community options Eleventy (11ty) vs. Hugo How to set up WYSIWYG editing with MkDocs Material The rise of static-first websites: why major brands are making the switch Watching your Core Web Vitals on Jamstack Understanding the difference between static, dynamic, and hybrid websites Looking for an alternative to Netlify CMS or Decap CMS? Designing components for your website editors: a CloudCannon case study Content is sacred — so own your revision history The eternal balancing act: load time vs. delay time Streamlined Headless Mode, Unified Configuration, and live data editing What is a headless CMS? Looking for a TinaCMS or Tina Cloud alternative? The ultimate guide to Hugo Sections Coming soon: Live config editing and data reloading Faster publishing workflows out now! Why information architecture matters for your website Website UX vs SEO: picking your battles Easily manage your multilingual Astro site in CloudCannon How you can optimize publishing workflows for your content team How you can optimize your CMS for SEO success How you can optimize your Content Editor for long-form articles How you can optimize your Visual Editor for page building Secure, swift, and stable: static sites for the financial sector Enhanced flexibility for teams with Custom Permissions Building static sites that scale The Inaugural 11ty International Symposium on Making Web Sites Real Good How to manage hundreds of connected websites with a Git-based headless CMS How we’re building CloudCannon for accessibility CloudCannon’s new editing improvements are here! Open Beta | New ways to collaborate on editing your websites Top 11 free Eleventy themes for 2024 Top 10 free Astro themes to use in 2024 Why choose a Git-based headless CMS over a monolithic DXP in 2024? Learning web development: a self-guided roadmap Partner Site of the Month: Blüthner Piano Centre, by Winteractive CloudCannon’s 2023 wrapup Let’s create a microblog with visual editing using Bookshop and Eleventy Update and visualize your branches with CloudCannon Projects What is a Git-based CMS and why you should use one CloudCannon secures SOC 2 certification The complete guide to growing your web development agency Automatically optimize your images with Eleventy Image and CloudCannon Share components and syndicate content with Site Mounting Partner Site of the Month: Cru Uncorked, by Ed Meehan New web component for responsive HTML tables Wrapping up HugoConf 2023 Partner Site of the Month: Van Dillen Antieke Bouwmaterialen, by Fulldev How to become a freelance web developer: a comprehensive guide Q3 2023: CloudCannon features and improvements 22 ways to deliver more value to your web development clients Partner Site of the Month: DC Gay Flag Football League, by Ed Cupaioli A new way to configure your CloudCannon sites CloudCannon — the official CMS partner of Eleventy Full CloudCannon support for Nuxt static sites Partner Site of the Month: Stadium Bike, by Insight Creative, Inc. HugoConf 2023, brought to you by CloudCannon DAM Support for Cloudflare R2 and DigitalOcean Spaces Eleventy (11ty) vs. Gatsby in 2023 – which SSG is best for you? How CloudCannon’s live editing works with Astro and Bookshop Partner Site of the Month: Fiducian, by Croissant & Baguette Eleventy (11ty) vs. Astro How to customize CloudCannon’s Client Sharing interface Let anyone, anywhere, edit your CloudCannon sites Top 23 free Astro themes for building out-of-this-world static sites in 2023 How Jampack optimizes our Eleventy website and improves performance Astro vs. Next.js CloudCannon.com is now built with Eleventy! Out-of-this-world support for all Astro users Introducing the CloudCannon Partner Program Full CloudCannon support for Gatsby Top 10 Free SvelteKit Themes for Building Lighting-Fast Static Sites in 2023 Enhanced CloudCannon support for Next.js users Upcoming CloudCannon Interface improvements (Open Beta) Creating sites, the Jamstack way
Does my website look big in this? Six tips to lower your page weight
2024-10-21 · via CloudCannon Blog

Personally, the biggest drawcards to static sites over yet another WordPress install — and probably the biggest reasons I wanted to work for CloudCannon — were the promises of reducing both overall energy expenditure (in the form of both page weight and compute time) and my own over-reliance on PHP, proprietary databases, and teetering tech stacks.

Minimal computing and #leanweb Direct link to this section

By the time I shifted over to #leanweb I’d already read some convincing position statements by Alex Gil and Jentery Sayers, focusing on what they and others call minimal computing — which their working group describes as:

computing done under some set of significant constraints of hardware, software, education, network capacity, power, or other factors. … Minimal computing is also a critical movement, akin to environmentalism, asking for balance between gains and costs in related areas.

[Emphasis added.]

In an ideal world, we’d like all of our websites to work equally well regardless of network capacity or user knowledge — from site creation, through various edits and changes all the way to preservation, in high- and low-bandwidth scenarios, across as many devices as possible.

What are your current constraints? Direct link to this section

We always have constraints, of course: if it’s not time, it’s usually our own energy or enthusiasm to learn a new approach, or find the balance between costs and gains.

But I think collectively, as part of the static site community, we can address a lot of the most common constraints, or at least make significant improvements to the dynamic render-on-demand status quo:

  • The barrier for entry when it comes to site creation, via a static site generator (or a CMS that assists an SSG), is lower than ever, as more developers are shifting to modern static websites. With an ecosystem of commercial and open-source tooling around the generators themselves, SSGs are becoming more accessible for non-technical users.
  • Static sites, being structures of flat files, are naturally preservable, without reliance on opaque database structures or vendor lock-in. (And versioning via a Git-based CMS like CloudCannon allows an easy way to track all of your site changes over time.)
  • CloudCannon’s Visual and Content Editor views also help greatly with the editing side of things, without adding dependencies beyond a couple of configuration files.

This leaves us with one major constraint to work under: variable user bandwidth. The solution to this constraint is obvious: lower our page weights. How to get there, though? Well, for most developers, the journey is half the fun.

On an episode of CloudCannon’s Static Feedback webinar, Joost van der Schee and I discussed how to apply constraints to our workflows, and what bandwidth and page weight means to the user experience in terms of speed and satisfaction. While we focused then on the almost philosophical approach of knowing the purpose of each line of code, we didn’t extend the scope of our conversation quite so much to search rankings, which depend in part on low page weights, nor the slow but pleasurable journey of fine-tuning websites, page by page and tool by tool.

Before I dive in today, it’s worth noting that I’m not advocating for all sites to be as aggressively minimalist as the Musk Foundation’s, or as transparently sustainable as Low-tech Magazine’s self-hosted, off-grid and solar-powered site. There are, however, comparatively large bandwidth and data savings we can make on our websites and the tools we use on them, simply by keeping bandwidth constraints in the forefront of our minds.

Tools for lowering your page weight Direct link to this section

1. Image and video optimization Direct link to this section

This is one of the most impactful changes you can make to your bandwidth usage, but you’re probably always trying to balance acceptable size against acceptable quality. Where your project sits on this spectrum is up to you, but there are several tools and approaches that might help:

Use formats like WebP and AVIF — this is an offline solution, but deciding on an efficient modern format for your assets is an excellent first step.

Use a service like ImageOptim for offline preparation of single or multiple images, once you’ve settled on your preferred image format.

Image management tools within your SSG —Joost gave a HugoConf talk on resizing all images in a Hugo project, targeting resources over a certain size and using a render hook for images within markdown content. Other SSGs will have different solutions: if you’re using Eleventy, the official eleventy-img plugin performs build-time image transformations for both vector and raster images, and outputs multiple formats. And on Jekyll, a plugin like jekyll-image-size will help generate a range of image sizes for different screens, along with Open Graph link tags, img-tags, CSS, and HTML props.

2. CSS optimization Direct link to this section

If you’re hand-crafting your CSS, using only the exact classes you need, you’ll still probably find that your CSS file size grows as your site does. But it doesn’t need to grow too much — you can remove unused classes with tools like Purge CSS .

It might be a point of contention for artisanal purists, but even if you’re committed to the artisanal approach, I’d recommend extending your ‘knowledge toolkit’ to include Tailwind CSS. It has excellent documentation, which really helps you get your head around everything it’s doing behind the scenes. Yes, its development builds are large by design, but optimizing for production tree-shakes very efficiently, to the point that most CSS files, compressed, won’t exceed 10kb. As their docs put it:

Think of Tailwind like a giant box of LEGO — you dump it all out on the floor and build what you want to build, then when you’re done you put all the pieces you didn’t use back into the box.

Tailwind creator Adam Wathan has written up a great article on the transition from ‘traditional CSS’ to the ‘utility-first CSS’ that Tailwind enables, and while it might take a while to switch lanes, you’ll probably find that the fact that utilities offer a further set of constraints, which help to enforce consistency for team development.

3. Minify your HTML and JS Direct link to this section

When it comes to minifying HTML and JS your performance gains will likely be small, as these tools strip out unnecessary whitespace, newlines, comments, and indentation, as well as crunching variable names. You can find manual minifying tools easily enough in a basic web search; for my SSG of choice, Hugo, I’d use Hugo Pipes and resources.Minify to reduce CSS, JS, JSON, HTML, SVG, and XML in one command.

4. Gzipping your files Direct link to this section

Gzip identifies repetitive strings within your files, and replaces them with a token, resulting in significant size and pageweight savings. As with minification, the result is perfectly readable for browsers, but not exactly friendly for human readers — but that’s okay, since both minification and gzipping are part of your build process. Still confused about the difference? See Chris Coyier’s excellent article comparing the two approaches. Chris gives the example of Bootstrap’s CSS file (147KB): minified, it’s 123KB; gzipped, it’s 22KB; and with both approaches combined, it’s a mere 20KB.

5. Bundling JS Direct link to this section

JavaScript bundling merges multiple JS files together into a single file, reduce the number of page requests. Depending on your SSG, approaches for bundling will vary; Hugo uses Pipes and resources.Concat, for example.

6. Consider performance and additional site functions Direct link to this section

You probably already have a set of tools you habitually turn to for additional site features, but the artisanal approach is about consciously creating new habits. Here are a few of my favorite tools, and general approaches to optimizing performance:

Pagefind for site search — Static search that scales incredibly well, for sites up to 100k+ pages. Pagefind is built with low network requests as a primary constraint, and still manages to deliver an extremely polished performance.

Delay loading assets — To be sure that your images and JavaScript are only loaded when your user needs them, use the lazy loading attribute for your images and delay your JavaScript until the component is in the viewport.

Inspect your sites and watch your network traffic — Try using a tool like web.dev/measure — it’s a great habit to be in before you publish anything. (And if you have the luxury of colleagues to double-check your optimizing strategy, it’s amazing how much of a difference it can make at this point.)

Agree on constraints with your team — If you develop as part of a team, one of the best ways to lower your site’s weight overall is to make sure that everyone on your team is on the same page. It’s a valuable conversation to have every few months, and it will help to shape the guidelines you all use for your own best practices.

Page weight and sustainable web design Direct link to this section

I recently read with great interest the manifesto of a new web design agency, Dodonut. Their stated mission — their primary constraint, laid bare for the web to see — is to create a positive environmental impact, largely by reducing emissions related to the products they design. They include a persuasive carbon calculator on their homepage, directly equating page weight to CO₂ emissions, and contextualizing the environmental value of removing as little as 50kb from a site with reasonable traffic.

Dodonut comes with a great pedigree, too; not an entirely new entity, it’s part of Bejamas, the 2021 Jamstack Agency of the Year. So with this wealth of static development knowledge, a ready supply of assistive developer tooling, and above all the desire to reduce page weight, things are looking good for both Dodonut’s customers and the planet.

Where should I start? Direct link to this section

I’d start by assessing how much extraneous code you’re shipping. Look at your favorite technologies — what are you using because you’ve always used it? What do you know is inefficient, but you do it anyway?

Alternatively, you can just start minifying and gzipping where you’re not already, or looking for other easy wins. Why not start with your images. Perhaps you’ll optimize one at a time, and reduce your page weight by just 20kb. That’s still a great start! Or maybe you’ll go all out, and aim for a complete website no larger than 100kb. Constraints, you’ll remember, are shifting targets we can set for ourselves on a per-project basis — we have to start somewhere, and what you regard as ‘best practice’ can and should evolve as you keep developing.

For now, we know that excess page weight makes for a sub-optimal user experience, reduces SEO rankings, and contributes to emissions. And with all of these factors in mind, we have a productive constraint. So let’s get creative with it.