Skip to content

Scripts: Control Directives for RTLCSS don't work in build command #68364

@t-hamano

Description

@t-hamano

Description

In #61540, wp-scripts supported CSS for RTL languages. Also, with RTLCSS, you can add some processing via the Control Directives.

However, this Control Directives does not seem to work with the build command.

I thought that #68201 might be affecting this, but it seems that's not the case. I don't know if the control directives were not working from the beginning.

cc @gziolo @ryelle

Step-by-step reproduction instructions

Use the following command to create a block without wp-script:

npx wp-create-block my-block --no-wp-scripts
cd my-block

Update the my-block/src/editor.scss file as follows:

.wp-block-create-block-my-block {
	/*rtl:ignore*/
	text-align: left;
	/*rtl:remove*/
	background: #ccc;
}

✅ Run ../node_modules/.bin/wp-scripts start and check the build file. Confirm that the controls directive is working.

index.css:

.wp-block-create-block-my-block {
  /*rtl:ignore*/
  text-align: left;
  /*rtl:remove*/
  background: #ccc;
}

index-rtl.css:

.wp-block-create-block-my-block {
  text-align: left;
}

❌ Run ../node_modules/.bin/wp-scripts build and check the build file. Confirm that the controls directive is NOT working.

index.css:

.wp-block-create-block-my-block{
	background:#ccc;
	text-align:left
}

index-rtl.css:

.wp-block-create-block-my-block{
	background:#ccc;
	text-align:right
}

Screenshots, screen recording, code snippet

b57b77409fdef37f9e0aea1bd2260107.mp4

Environment info

OS: WSL2 (Ubuntu 22.04.4 LTS)

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Status] In ProgressTracking issues with work in progress[Tool] WP Scripts/packages/scripts[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions