Code Monkey home page Code Monkey logo

givewp-addon-boilerplate's Introduction

GiveWP - Addon Boilerplate

A demo plugin to serve as a boilerplate for developers to understand how to extend the GiveWP Donation plugin for WordPress.

Setup & Installation

  1. Clone this repository to your local
  2. Remove the .git directory
  3. Run php build.php from the CLI
  4. Run composer install from the CLI
  5. Run npm install from the CLI
  6. Update this README (see below for a starting point)

Asset Compilation

To compile your CSS & JS assets, run one of the following:

  • npm run dev — Compiles all assets for development one time
  • npm run watch — Compiles all assets for development one time and then watches for changes, supporting BrowserSync
  • npm run hot — Compiles all assets for development one time and then watches for hot replacement
  • npm run dev — Compiles all assets for production one time

Concepts

GiveWP follows a domain-driven model both in core and in add-ons. Each business feature defines its own domain, including whatever it needs (settings, models, etc.) to do what it does. It's also important these domains are portable, that is, they are not bound to the plugin and could move to or from another plugin as needed.

For these reasons, each add-on has two primary directories for handling its logic:

  • src/Addon
  • src/Domain

src directory

The src directory handles business domain logic (i.e. a specific feature). The src directory should have no files in the root, but be a collection of folders. Each folder represents a distinct domain. Even if there is only one domain for the add-on, it should still live inside a domain directory.

src/Domain directory

It is possible for an add-on to have multiple domains, but it will always have at least one. Feel free to duplicate this directory and make more. This directory is just the starting point for the initial domain.

src/Addon directory

This unique domain directory is responsible for the fact that the add-on is a WordPress plugin. Plugins do things such as activate, upgrade, and uninstall — the logic of which should be handled there. All GiveWP add-ons also check for compatibility with GiveWP core, and this also is handled here.

The src/Addon directory may reference code in the src directory, but not the other way around. No domain code should reference (and therefore depend on) the src/Addon directory. Doing this keeps the dependency unidirectional.

Note for developers

If running npm run dev throws an error then check whether the images folder exists in your addon directory under src/Addon/resources.

  1. If the images folder does not exist then create one.
  2. If the images folder isn't required then remove the code from webpack.config.js.

DELETE ABOVE THIS LINE WHEN REWRITING README


Introduction

[Write an introduction to what this addon is for]

Development

Getting Set Up

  1. Clone this repository locally
  2. Run composer install from the CLI
  3. Run npm install from the CLI

Asset Compilation

To compile your CSS & JS assets, run one of the following:

  • npm run dev — Compiles all assets for development one time
  • npm run watch — Compiles all assets for development one time and then watches for changes, supporting BrowserSync
  • npm run hot — Compiles all assets for development one time and then watches for hot replacement
  • npm run dev — Compiles all assets for production one time

givewp-addon-boilerplate's People

Contributors

ravinderk avatar alaca avatar kjohnson avatar jasontheadams avatar devinwalker avatar mehul0810 avatar jonwaldstein avatar mathetos avatar knowler avatar raftaar1191 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.