Sometimes we need a modern, flexibile, and extensible solution to frontend problems in a WordPress project. Some things that need to be handled are too complex or require more reactivity and organization than vanilla JS or jQuery could reasonably accommodate.
Also, Vue is awesome, and who wouldn't want to use it every chance they get?
cd app && yarn install
to get things started.- Once the dependencies are installed develop your app and run
yarn build
. The script will automatically paste the dist folder and its contents into the WordPress plugin folder. - Take the contents of
/plugin
and upload it to your WordPress project's/wp-content/plugins
folder. - Log into WordPress and activate the plugin.
- Add the shortchode defined in the plugin file (It's
[vue_wp]
by default) to any WordPress page or post. Paste<?php echo do_shortcode("[vue_wp]"); ?>
into a template if you'd prefer to directly embed it in the code. - Sit back and contemplate how great life is now.
cd app
to get to Vue app root directoryyarn jest
to run all tests. Run with--watch
for continuous refresh and to learn about options for test runs.