Skip to content

build(css): resolve @import in unminified CSS output - #44

Merged
Hug0-Drelon merged 3 commits into
masterfrom
build/css-resolve-import-unminified
Sep 3, 2026
Merged

build(css): resolve @import in unminified CSS output#44
Hug0-Drelon merged 3 commits into
masterfrom
build/css-resolve-import-unminified

Conversation

@Hug0-Drelon

Copy link
Copy Markdown
Member

What?

Resolve CSS @import statements at build time for both unminified (.css) and minified (.min.css) outputs.

Why?

Closes the gap where only minified CSS had imports bundled, forcing plugins to ship css/build/lib/ partials for SCRIPT_DEBUG users. Aligns CSS with the existing JS bundling behavior (part of polylang/polylang-pro#1430).

How?

  • Remove CopyPlugin from transformCssEntry; emit [name].css and [name].min.css from the same entry.
  • Bump to v2.4.0; drop copy-webpack-plugin peer dependency.
  • Add unit and integration tests for the CSS transformer.

Test plan

  • npm test passes (51 tests)
  • Publish @wpsyntex/polylang-build-scripts@2.4.0 before merging dependent PRs

Bundle CSS @import statements at build time for both .css and .min.css
outputs, mirroring the existing JS build behavior and removing the need
for css/build/lib/ copy workarounds.
@Hug0-Drelon Hug0-Drelon self-assigned this Sep 2, 2026
@Hug0-Drelon Hug0-Drelon added the enhancement New feature or request label Sep 2, 2026
Comment thread transformers/css.integration.test.js Outdated
Comment on lines +59 to +62
expect( unminifiedCss ).toContain( '.partial' );
expect( minifiedCss ).toContain( '.partial' );
expect( unminifiedCss ).toContain( '.entry' );
expect( minifiedCss ).toContain( '.entry' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe useless but we could test that the content is minified or not too.

  • Minified: .partial{
  • Not minified: .partial {

What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea, even though unit tests already cover the minimize flag.

See e8817bd

Verify integration output preserves readable CSS spacing in .css files
and minified selector syntax in .min.css files.
@Hug0-Drelon
Hug0-Drelon merged commit cbf26ae into master Sep 3, 2026
3 checks passed
@Hug0-Drelon
Hug0-Drelon deleted the build/css-resolve-import-unminified branch September 3, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants