parcel-bundler / parcel-bundler/lightningcss

CLI glob pattern does not preserve files location

Open
#482 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

Not necessarily a bug, as #90 does not mention any particular outcome or use case scenarios. It would be helpful to extend this functionality to preserve directory structure when used with glob pattern and without --bundle, single file output.

With nested dir structure:

+ /resources/css
+-+ /components
    +-- /button.css
    +-- /input.css
+-+ /sections
    +-- /newsletter.css
    +-- /cta.css
+-- /layout.css
+-- /reset.css

CLI command with glob pattern #90:

lightningcss resources/css/**/*.css --output-dir public/css

Will produce flat output (missing subfolders) and root lvl files (layout.css and reset.css) are lost:

+ /public/css
+-- /button.css
+-- /input.css
+-- /newsletter.css
+-- /cta.css

Expected output would be to preserve the structure and root lvl files:

+ /public/css
+-+ /components
    +-- /button.css
    +-- /input.css
+-+ /sections
    +-- /newsletter.css
    +-- /cta.css
+-- /layout.css
+-- /reset.css

Current behavior creates few problems:

  • file names has to be unique in different folders
  • some files are lost from glob pattern
  • complicates build scripts with multiple calls *
  • build scripts are not dynamic as each subdir has to be added manually

*It is possible to workaround this by calling CLI multiple times (but that's not glob support mentioned in #90):

lightningcss resources/css/components/*.css --output-dir public/css/components
lightningcss resources/css/sections/*.css --output-dir public/css/sections
lightningcss resources/css/*.css --output-dir public/css

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the CLI glob expansion and --output-dir handling, then run the documented lightningcss resources/css/**/*.css --output-dir public/css command against the nested example. Done means matching subdirectories are preserved, root-level files are included, and the resulting public/css tree matches the expected structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.