admin管理员组

文章数量:1130754

I am developing a block using block.json and I could load RTL CSS on backend using this code:

// Check if RTL mode is enabled
if (wp.i18n.isRTL()) {
// Import RTL stylesheet if RTL mode is enabled
import('./style-rtl.scss');
}

But I don’t know how can I load RTL CSS on frontend on RTL mode using block.json
I couldn’t find any documentation about this on WP site
Just need to load RTL CSS on frontend only when we use the block in the site
I know how to load CSS styles in PHP but I just need to know how to load RTL CSS using block.json for block editor development
I just found these two actions to load scripts for block editor:

enqueue_block_assets
enqueue_block_editor_assets

These things helps too much but I think there should be a better way to load CSS styles for RTL automatically when we use the specific block

I read in the documentations that CSS styles loads automatically for every blocks, But I don’t know how to load RTL CSS automatically using block.json
Appreciate for any help

本文标签: Load RTL CSS using blockjson for block development