Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Migration Plan: PostCSS to Lightning CSS

  • Update package.json
    • Remove PostCSS dependencies (postcss, postcss-cli, postcss-nesting, cssnano)
    • Add lightningcss-cli dependency
    • Add lightningcss dependency (needed for Vite)
    • Update build-css script to use lightningcss
    • Update build-css:min script to use lightningcss with minification
  • Update vite.config.js
    • Remove postcss-nesting import
    • Replace postcss configuration with Lightning CSS transformer
    • Configure nesting support in lightningcss options
  • Test the changes
    • Build CSS files with new scripts
    • Run the development server to verify Vite config
    • Verify the build completes successfully
    • Run linting to ensure no regressions
Original prompt

Objective

Migrate the project from PostCSS to Lightning CSS for faster CSS processing and built-in modern CSS features support.

Changes Required

1. Update package.json

  • Remove the following devDependencies:

    • postcss
    • postcss-cli
    • postcss-nesting
    • cssnano
  • Add the following devDependencies:

    • lightningcss-cli (latest version)
  • Update build scripts to use Lightning CSS instead of PostCSS:

    • build-css: Change from postcss src/index.css --use postcss-nesting > dist/index.css to lightningcss --nesting --bundle --targets '>= 0.25%' src/index.css -o dist/index.css
    • build-css:min: Change from postcss src/index.css --use cssnano postcss-nesting > dist/index.min.css to lightningcss --nesting --bundle --minify --targets '>= 0.25%' src/index.css -o dist/index.min.css

2. Update vite.config.js

Replace the PostCSS configuration with Lightning CSS. The current file at vite.config.js uses:

import postcssNesting from 'postcss-nesting'

css: {
    postcss: {
        plugins: [
            postcssNesting
        ],
    },
}

Change it to use Lightning CSS with Vite's built-in support:

css: {
    transformer: 'lightningcss',
    lightningcss: {
        drafts: {
            nesting: true
        }
    }
}

Remove the import postcssNesting from 'postcss-nesting' line.

3. CSS Files

The CSS files in src/index.css and example/index.css use CSS nesting which is already supported natively by Lightning CSS - no changes needed to the CSS syntax.

Context

  • Lightning CSS is a faster CSS parser, transformer, and minifier written in Rust
  • It has built-in support for CSS nesting (currently used via postcss-nesting)
  • It provides built-in minification (replacing cssnano)
  • This migration is based on the pattern used in @substrate-system/stream

Files to Modify

  1. package.json - Update dependencies and build scripts
  2. vite.config.js - Replace PostCSS configuration with Lightning CSS

This pull request was created from Copilot chat.


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

Co-authored-by: nichoth <5776508+nichoth@users.noreply.github.com>
@socket-security
Copy link

socket-security bot commented Jan 23, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedlightningcss-cli@​1.31.181100999170
Addedlightningcss@​1.31.1991001009170

View full report

Co-authored-by: nichoth <5776508+nichoth@users.noreply.github.com>
@nichoth nichoth marked this pull request as ready for review January 23, 2026 21:46
@nichoth nichoth merged commit 62a706a into main Jan 23, 2026
3 checks passed
Copilot AI requested a review from nichoth January 23, 2026 21:46
Copilot stopped work on behalf of nichoth due to an error January 23, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants