JavaScript for WordPress › Forums › Gutenberg Development › Can't get the CSS files built
- This topic has 5 replies, 2 voices, and was last updated 7 years ago by
Ali Khallad.
-
AuthorPosts
-
May 20, 2019 at 2:24 am #107948
Ali Khallad
ParticipantHi
this is my webpack file content: https://pastebin.com/ybVts8Du
this is the package file content: https://pastebin.com/FXJiHNyeWhen I try
npm run dev
or
npm run buildit builds the JS but not the CSS, I’m sure that the regex for CSS path is correct which block/css/style/ and block/css/editor-styles/ both folders has css and scss files in them.
Not sure what is wrong, there is no error or anything, and not sure how to debug.
May 20, 2019 at 10:34 am #107976Zac Gordon
KeymasterHi, when you use the webpack setup and file structure from the course does it work?
May 20, 2019 at 2:57 pm #107982Ali Khallad
ParticipantIt does work when using with the demo plugin although it produce some errors. However, when trying on my own plugin it doesn’t, I shared the setup above.
May 20, 2019 at 3:15 pm #107983Zac Gordon
KeymasterMy guess would be it either has to do with the tests (like this
test: /block\/css\/editor-styles\/.*\.s?css$/,)Or it has to do with the Babel config in the buildJS const.
Those would be my guesses as to where the problem exists.
May 20, 2019 at 3:42 pm #107997Ali Khallad
ParticipantNot there, all seem to be correct, I tried to copy exact webpack file from gutenberg-course and copied blocks folder, then it generated correctly on my plugin, but after one change to module.exports.entry, I changed the names for JS file and npm run dev again and it generated js but not css, this is a bit confusing.
May 20, 2019 at 4:09 pm #107998Ali Khallad
ParticipantAfter digging a bit, I understood that the other rules of module.export does not search by directory or anything, but rather handles files imported from the main js that is in the entry point I suppose.
How can I make it instead get a whole directory for example
block/css/block.cssblock/css/block.editor.cssthen build those into the appropriate folder with appropriate namesNow when I run it on ‘blocks/index.js’ it has the import ‘document’ inside it which make the rest of code handles css imported to this js file, when I change to my js file that has no import it run without an issue but my css folder is not generated.
-
AuthorPosts
- You must be logged in to reply to this topic.
