create-block-theme icon indicating copy to clipboard operation
create-block-theme copied to clipboard

Automatically enqueue style.css when creating a blank theme

Open annezazu opened this issue 2 years ago • 7 comments

Pulling in feedback from the FSE Outreach program's Build A Block Theme exploration:

There is an empty style sheet added when a blank theme is created with CBT plugin. But adding CSS to it doesn’t work until a functions.php is added to enqueue it. I think that style.css should automatically be enqueued or that a functions.php with the enqueue should be included. I am trying to use only the editor, but think that if the stylesheet is there, it should be usable.

annezazu avatar Apr 22 '23 19:04 annezazu

How can we explain to users that the Stylesheet is used because it is required to provide WordPress with information about the theme, like the theme name and version, not to add CSS? Add a comment to the file?

carolinan avatar Apr 22 '23 19:04 carolinan

Ohh I see. Thanks for clarifying -- limits of my lack of knowledge with themes. I think a comment is a great idea and approach.

annezazu avatar Apr 22 '23 19:04 annezazu

In a way I agree that "if it is there it should work", but in this case it can't be removed even if it is otherwise empty.

I also think that if the person knows that the theme needs a functions.php and knows the css file needs to be enqueud, its not too difficult for them to add it.

So is it more beneficial to:

  • enqueu it "in case anyone wants to use it" Or,
  • not include a file that is not used by default (functions.php), and not enqueu a file that is not used by default (style.css)

carolinan avatar Apr 23 '23 02:04 carolinan

This came up again with a user in the forum: https://wordpress.org/support/topic/create-a-child-theme-for-twenty-twenty-three/

So is it more beneficial to:

- enqueu it "in case anyone wants to use it"
Or,
  • not include a file that is not used by default (functions.php), and not enqueu a file that is not used by default (style.css)

I agree very much with @carolinan that it would be much less confusing for users to go with either of these two options.

kathrynwp avatar Jun 13 '23 13:06 kathrynwp

I would prefer to use a style.css file than the Additional CSS area in the FSE block editor. The Additional CSS UI and accessibility is dreadful. I find it much simpler to use a style.css file, but to have to enqueue it yourself? Led me down a rabbit hole that I'm finally climbing out of.

askdesign avatar Jan 19 '24 21:01 askdesign

Just ran into this issue and it definitely needs some love.

tomfinitely avatar Aug 05 '24 14:08 tomfinitely

I agree. Style.css file for me as well. Definitely should be enqueued already, even if it's not used. It will be there for those who want to.

cre8tivediva avatar Aug 05 '24 15:08 cre8tivediva