JavaScript for WordPress Forums Gutenberg Development import './style.scss';

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #46912
    jasonyingling
    Participant

    I may have missed it in my watch through the course, but what does importing style.scss provide differently than enqueueing the stylesheets for the block?

    I was reading through the index.js for sample plugins and this was the only thing I didn’t feel like I could explain.

    Thanks for the great course.

    #46926
    Zac Gordon
    Keymaster

    Hey Jason!

    Importing the css in this way is simply one of the styling patterns for React. Gutenberg Core uses it so for these reasons I’m using it here. In these examples, webpack is processing and spitting out the final css that we end up enqueuing.

    You can also just have a single css file (or other architecture) and enqueue that. I think either way is probable fine and not a major benefit one way or the other if you don’t have a preference (or do :))

    Hope that helps! Good question 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.