There are some advantages and disadvantages of combining Laravel and WordPress. I am not going to dig deep into it but in case you’re looking for steps to combine both, where they are.
Make sure you have these dependencies installed on your local or web server.
Install or download a copy of a WordPress version 4.7 or higher.
Go to your WordPress themes directory using this command (Assuming you are at the root level of your WordPress installation):
Install the Sage theme using the following command.
composer create-project roots/sage
You will see different options to define theme meta information such as theme name, theme URI, theme description, theme version and theme author.
At the end, it will ask for and choose a CSS framework from Bootstrap, Bulma, Foundation, Tachyons and Tailwind. You can also just start from a blank slate and not select any of those CSS frameworks.
Add dependencies using yarn.
Go to your Sage theme directory using this command (Assuming you are at the root level of your WordPress installation):
Run this command:
After that, you’ll have all the required dependencies to build the project after a change.
You can also change Browsersync configuration, Server configuration and configure Stylesheets and scripts.
Make changes to your project assets and compile them to see the changes.
Use this command to compile and optimize the files in your assets directory:
Use this command to compile and optimize the files in your assets directory for production:
Use this command to compile assets when file changes are made, start Browersync session:
yarn build:production yarn start
Step 7 : Optional
Use this remedy if you see this error:
“Yarn fails to compile when Sage project created with Tailwind selected. PostCSS Loader has been initialized using an options object that does not match the API schema.”
Solution (Run the following commands one by one):
npm uninstall postcss-loader --save-dev npm install postcss-loader@~3.0.0 --save-dev yarn
That should do it. Your project should be up and running.
There are tons of additional changes you can make using the Sage documentation.