Skip to content

Commit

Permalink
Add clarification about importing css/scss files
Browse files Browse the repository at this point in the history
  • Loading branch information
colorful-tones committed Aug 7, 2024
1 parent 4b25473 commit b36986f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ And a `style.css` file to load on the frontend:

The files will automatically be enqueued when specified in the block.json.

You will still need to import your stylesheet within your corresponding JavaSript file in order for `@wordpress/scripts` to process the stylesheet.

Example:

- In `edit.js` you would place `import './editor.scss';`
- In `index.js` you would place `import './style.scss';`
- In `view.js` you would place `import './view.scss';` (interactive block template)

**Note:** If you have multiple files to include, you can use standard `wp_enqueue_style` functions like any other plugin or theme. You will want to use the following hooks for the block editor:

- `enqueue_block_editor_assets` - to load only in editor view
Expand Down

0 comments on commit b36986f

Please sign in to comment.