Creating a theme with React #1302
-
I've been looking through the documentation but haven't found any way to create a theme for WinterCMS using React.js. Can anyone from the community help me? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@joelcosta-mooddie give this PR a try: #1304 After you have it locally you'll want to do the following:
At some point we'll probably refactor the theme scaffolding system to make it easier to add in various asset bundles like Vue or React, but for now this should be a balance between getting something that works and investing a ton of time into refactors. Let me know if you run into any issues or have any questions! |
Beta Was this translation helpful? Give feedback.
@joelcosta-mooddie give this PR a try: #1304
After you have it locally you'll want to do the following:
artisan create:theme mytheme tailwind
to generate a theme that makes use of Tailwindartisan vite:create theme-mytheme --tailwind --react --force
to generate the required files for Reactartisan vite:install
and answer yes to the prompt asking to include mytheme in your package workspace if it asks.{{ viteReactRefresh('theme-mytheme') }}
immediately above the{{ vite() }}
tag inthemes/mytheme/partials/site/footer.htm
<div id="root"></div>
wherever you want your React app to be injected into the DOM (either inthemes/mytheme/layouts/default.htm
orthemes/mytheme/pa…