Step 1: Prerequisites
- Make sure you have the following software installed on your machine:
- PHP (>= 7.2.0)
- MySQL (>= 5.0)
- Composer
- Node.js (>= 16.x)
Step 2: Setup wordpress development environment
- Set wordpress debugging mode values in your wordpress directory
wp-config.php
:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
Step 3: Clone the Repository
- Open your terminal or command prompt.
- Change the current working directory to the location where you want to clone the repository.
- Fork the dokan weDevs official github repository.
- Run the following command to clone your forked repository:
git clone https://github.com/YOUR-USERNAME/dokan.git
Step 4: Install Dependencies
- Navigate to the cloned repository:
cd dokan
- Install PHP dependencies using Composer:
composer install && composer du -o
- Install JavaScript dependencies using npm:
npm install
Step 5: Build Assets
- Build the frontend assets using the following command:
npm run build
- Build the frontend assets for development (webpack watch mode):
npm run start
All avaialable commands
- Build assets ( watch mode )
npm run start
- Build assets ( Watch mode with hot reload )
npm run start:hot
- Build assets for production
npm run build
- Update all npm packages
npm run packages-update
- Replace all
DOKAN_SINCE
version into current version from package.json.
npm run version
- Make or regenerate pot file
npm run makepot
- Converts WordPress readme.txt file to markdown (readme.md )
npm run readme
- Removes all the unnecessery files in dokan.
npm run clean-files
- Creates zip file
npm run zip
- Formats all the .js files in dokan lite but you can also formte any .js file by providing it's path when running the command.
npm run format
- Makes a product build zip of dokan lite.
npm run release
Building assets
- Always add
.js
file intosrc
roassets/src
folder, never add files directly intoassets/js
folder and less files intoassets/src/less
. - If any jquery plugin is needed to add, you can add it into
assets/vendor
directory. - When you
add
js orless
files intosrc
roassets/src
add that js or less as entry inwebpack.config.js
inentryPoint
object - For unnecessery file cleaning or any file you don't in production you can add it in
bin/clean-useless-files.js
. Add the file dir intargetFiles
object. The path is not absolute path, it is after the dokan plugin directory, Ex:'assets/js/dokan-admin-product-style.js'