Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 30, 2025

Adds cssnano to the PostCSS pipeline to optimize CSS output in production and staging builds.

Changes

  • esbuild.js: Added getPostcssPlugins(env) function that conditionally includes cssnano based on build environment
    • Production/staging: Applies cssnano with comment removal preset
    • Development: Skips cssnano to preserve readable CSS for debugging
  • package.json: Added cssnano@7.1.2 as dev dependency

Example

const getPostcssPlugins = (env) => {
  const plugins = [postcssUrl({ /* ... */ })]
  
  if (env === "production" || env === "staging") {
    plugins.push(cssnano({
      preset: ['default', { discardComments: { removeAll: true } }]
    }))
  }
  
  return plugins
}

Impact

CSS file sizes reduced by ~7% (e.g., carousel: 82K → 76K) through minification, duplicate rule merging, and value optimization.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Incorporate cssnano


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 30, 2025 02:30
Co-authored-by: oliverkuchies <11084292+oliverkuchies@users.noreply.github.com>
Co-authored-by: oliverkuchies <11084292+oliverkuchies@users.noreply.github.com>
Copilot AI changed the title [WIP] Incorporate cssnano for CSS optimization Integrate cssnano for CSS optimization Oct 30, 2025
Copilot AI requested a review from oliverkuchies October 30, 2025 02:40
Copilot finished work on behalf of oliverkuchies October 30, 2025 02:40
@oliverkuchies oliverkuchies marked this pull request as ready for review October 30, 2025 03:58
Copilot AI review requested due to automatic review settings October 30, 2025 03:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates cssnano into the build pipeline to optimize CSS output in production and staging environments. The implementation conditionally applies CSS minification based on the build environment, reducing file sizes by approximately 7% while preserving readable CSS during development.

Key changes:

  • Created environment-aware PostCSS plugin configuration with conditional cssnano optimization
  • Added cssnano package dependency for CSS minification capabilities

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
packages/widget-utils Updated subproject commit reference
package.json Added cssnano v7.1.2 as development dependency
esbuild.js Refactored PostCSS configuration into getPostcssPlugins() function with conditional cssnano integration

@olivernosto olivernosto merged commit 70efde2 into master Oct 31, 2025
6 checks passed
@olivernosto olivernosto deleted the copilot/add-cssnano-integration branch October 31, 2025 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants