Move theme-css docs to a dedicated file and auto-run on npm run dev - #123
Open
dmytrobez wants to merge 2 commits into
Open
Move theme-css docs to a dedicated file and auto-run on npm run dev#123dmytrobez wants to merge 2 commits into
dmytrobez wants to merge 2 commits into
Conversation
The substantive how-to (local dev, CI overview, troubleshooting) was previously split between a stub in wordpress/README.md and a section buried inside docs/setup/deployment.md. Move it to a dedicated file and reduce the old locations to pointers / CI-only content.
Add a predev hook in wordpress/package.json that runs generate:theme-css before webpack starts, so developers no longer need to remember it manually. To keep the hook from blocking dev when WordPress is not reachable (e.g. before npm start), introduce a THEME_CSS_SOFT env flag in theme-css.sh that converts the unreachable-WP error into a warning and exits 0. Other errors (empty CSS output, etc.) still hard-fail. Manual invocation of generate:theme-css keeps the original strict behavior since THEME_CSS_SOFT is only set by the predev hook.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies team feedback on the original
feat/generate-css-vars-from-themework (already merged intofuture).Feedback addressed
wordpress/README.mdpointed nowhere useful, while the substantive how-to (local dev, CI overview, troubleshooting) was buried under a "Theme CSS Generation" section insidedocs/setup/deployment.md. A developer looking for "how do I refresh the theme CSS locally?" would never open the deployment doc.npm run generate:theme-css. Team suggestion: run it automatically when webpack restarts.Changes
Docs consolidation
docs/setup/theme-css.md— canonical doc (what it is, local dev with auto-run, CI overview, files, troubleshooting).wordpress/README.md: stub replaced with a one-line pointer.docs/setup/deployment.md: trimmed the Theme CSS section to CI-specific content only + a link to the new doc.Auto-run on
npm run devpredevinwordpress/package.json— regenerates the CSS before webpack starts.THEME_CSS_SOFT=1branch inwordpress/scripts/theme-css.shso thepredevhook doesn't block dev when WordPress isn't reachable (e.g. beforenpm start). Manual invocation ofgenerate:theme-csskeeps the original strict behavior.Test plan
npm --prefix wordpress run devwith WP up — see "Full theme CSS generated (X KB)" before webpack starts.npm --prefix wordpress run devwith WP down — see the skip message and confirm webpack still starts.WPCLI="wp @local" npm --prefix wordpress run generate:theme-csswith WP down — must still exit 1 (manual mode stays strict).docs/setup/theme-css.mdand confirm a fresh reader can answer "how do I refresh the CSS locally?" without leaving the page.