Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wordpress + Laravel Mix

Wordpress + Laravel Mix

Develop a theme with a modern development workflow

Avatar for Claudio La Barbera

Claudio La Barbera

November 22, 2022
Tweet

More Decks by Claudio La Barbera

Other Decks in Programming

Transcript

  1. What is Wordpress? WordPress is a free and open-source content

    management system (CMS) written in PHP and paired with a MySQL or MariaDB database. Features include a plugin architecture and a template system (called themes). https://github.com/WordPress/WordPress
  2. What is Laravel? Laravel is a free and open-source PHP

    web framework intended for the development of web applications following the model–view–controller (MVC) architectural pattern and based on Symfony. https://github.com/laravel/laravel
  3. What is Vue? Vue (pronounced /vjuː/, like view) is a

    JavaScript framework for building user interfaces. It builds on top of standard HTML, CSS, and JavaScript and provides a declarative and component-based programming model that helps you efficiently develop user interfaces, be they simple or complex. https://github.com/vuejs/core
  4. Some numbers about Wordpress • WordPress is used by 43.2%

    of all websites on the internet. (W3Techs, 2022) • WordPress is used by 65.2% of all websites using a CMS. (W3Techs, 2022) • WordPress powers 36.28% of the top 1 million websites. (BuiltWith, 2022) • Roughly every two minutes, another top 10 million site starts using WordPress. (W3Techs, 2021) • There are almost 60,000 free plugins in the official WordPress plugin directory. (WordPress, 2022) • There are over 9,000 free themes in the official WordPress theme repository. (WordPress, 2022)
  5. What is Laravel Mix? Laravel Mix provides a clean, fluent

    API for defining basic webpack build steps for your applications.
  6. What will we do? 1. Create a Twenty Twenty child

    theme 2. Configure Laravel Mix 3. Create and compile a SASS file (with Laravel Mix) 4. Create a widget with a Vue component (compiled with Laravel Mix)
  7. Create a Twenty Twenty child theme A child theme allows

    you to change small aspects of your site’s appearance yet still preserve your theme’s look and functionality. A parent theme is a complete theme which includes all of the required WordPress template files and assets for the theme to work. Wordpress themes are located in /wp-content/themes/ directory
  8. Create a Twenty Twenty child theme The following information is

    required: - Theme Name: needs to be unique to your theme - Template: the name of the parent theme directory
  9. Create a Twenty Twenty child theme The following information is

    required: - Theme Name: needs to be unique to your theme - Template: the name of the parent theme directory
  10. Create and compile a SASS file (with Laravel Mix) Run

    npx mix and watch your new css file: /css/homepage.css
  11. Conclusion We learned that Laravel Mix isn't just for Laravel

    projects, but it can be used also for Wordpress (and other CMS or PHP projects). Integrating it on a Wordpress Theme (or plugin) allow us to develop without a frustrating experience, using the modern tools that we are used to work with nowadays. Give a look to Laravel Mix Documentation to see how powerful it is: https://laravel-mix.com/docs/6.0/installation
  12. Some refs • Laravel Mix: https://laravel-mix.com/ • Wordpress Theme Development:

    https://codex.wordpress.org/Theme_Development • Wordpress Child Themes https://developer.wordpress.org/themes/advanced-topics/child-themes/ • Sass: https://sass-lang.com/ • Vue: https://vuejs.org/