A WordPress starter theme including Webpack (via Laravel Mix), Vue, Babel and Tailwind CSS.

  • By Jack Pallot
  • Last update: Aug 30, 2022
  • Comments: 4

Dogpatch

A WordPress starter theme including Webpack (via Laravel Mix), Vue, Babel and Tailwind CSS.


Inside Dogpatch

Javascript

  • A Webpack build system via Laravel Mix
  • Babel and ES Next support
  • ES2015 module support
  • Support for VueJS and Vue single file components
  • Build scripts - minifying, concatenation and renaming
  • Hot module reloading
  • Prettier config (can be adjusted if you prefer tabs over spaces)

CSS

  • Support for Sass
  • ITCSS directory structure for your Sass files
  • Zero setup Tailwind CSS framework support
  • Accessibility utilities for Tailwind CSS
  • Purge CSS to eliminate dead code (HTML, PHP, JS and Vue files)

WordPress

  • Optional helper functions for cleaning up WordPress, improving the core functionality and template utilities. Functions can be commented out and don't run by default
  • Component inheritance using the get_template_partial() function - letting you pass in props to a PHP template for DRY templating
  • .gitignore file with common patterns

Getting Started

Installing

Download the ZIP or clone the repository into your WordPress themes directory.

$ cd into the Dogpatch theme directory.

Install the project dependencies using NPM or Yarn:

npm install
yarn install
  • Amend the webpack.mix.js file with your settings.
  • Amend the src/tailwind.config.js file with your custom CSS classes.

⚠️ You will likely want to remove any references of Dogpatch and replace them with your current project name instead. ⚠️

  • Rename the theme folder
  • Amend the settings in style.css
  • Adjust the screenshots to your design

Development

To run a single instance of the dev build:

npm run dev
yarn run dev

To watch files through with live browser reloading:

npm run watch
yarn run watch

Hot Module Reloading

Hot module reloading is possible using the following:

npm run hot
yarn run hot

Production

Building for production will run the following tasks:

  • Convert ES Next using Babel
  • Minify and concat Sass and JS files
  • Run PurgeCSS to eliminate dead code
  • Auto-prefix
  • Move to /dist directory
npm run production
yarn run production

Updating

0.0.2 Two new functions added:

remove-gutenberg-styles.php - removes Gutenberg block editor styles pretty-print.php - nicer formatting on nested print statements with print_p()

Copy new files from /functions/core and /functions/template and copy functions.php. Comment out as needed.


No auto-updates through WordPress or child themes. These methods tend to cause behind the scenes conflicts and often cause more problems than they solve. Instead you can choose to patch the areas manually if you wish to do so, however, the benefit of being clean-slate means that updates should only require only minor changes.


Todo

  • Look at extracting Tailwind somehow as an optional dependency
  • Built in linting using ES Lint
  • Built in testing using Vue Testing Tools and either Mocha or Jest.

License

GNU General Public License v3.0

Github

https://github.com/jack-pallot/dogpatch

Comments(4)

  • 1

    'node_modules' is not recognized on Windows

    Great framework, however I cannot get any of the following commands to run on Windows:

    • npm run dev

    • npm run watch

    • npm run hot

    • npm run production

    Using NPM or Yarn creates the following error: image

  • 2

    Using Vue

    Hey great theme. I am trying to integrate Vue. Not a total noob but far from a pro. Here is what I have been trying:

    Here is my App.js

    import Vue from 'vue';
    import Example from './components/Example';
    
    new Vue({
      el: '#js-app',
      components: {
        Example, 
      },
    });
    

    Here is my Example.vue

    <template>
       <div>
          Hello World
       </div>
    </template>
    
    <script>
    export default {
    
    }
    </script>
    

    It shows the "Hello World" in my page but doesnt load any scripts after that.

    Here is the error it gives me

    • Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as