-
Notifications
You must be signed in to change notification settings - Fork 199
Setting Up Your Development Environment
This page will guide you through the process of setting up Sensei LMS development environment on your local machine. It should work on Linux, macOS, or Windows Subsystem for Linux on Windows 10.
- Pre-requisites
- Configure a local WordPress instance
- Clone Sensei LMS repository
- Install dependencies and generate assets
- IDE integrations
- Additional resources
Before starting, make sure you have the following software installed and working on your machine:
- Git to clone the Sensei LMS repository (or your fork of the Sensei LMS repository).
- Node.js (version == 16) and NPM to install Node packages used to build assets and other tasks.
-
Composer to install PHP packages required by Sensei LMS such as the
sensei-rest-api
and thejetpack-autoloader
. It's also necessary to use the PHP CodeSniffer that ensures your code follows code standards. - WP-CLI for updating i18n pot files.
For this guide we will use VVV, which is a local WordPress development environment built using Vagrant and VirtualBox, to run a local WordPress instance and install Sensei LMS on top of it. But it is worth noting that it is possible to set up a Sensei LMS development environment using several other stacks (docker, LAMP, etc). If you opt to use a solution other than VVV, you can skip to the next section. Keep in mind that you might need to make some small adjustments to the steps in the rest of this guide.
To configure our local WordPress instance, you will need to:
- Install VirtualBox
- Install vagrant
- Install and provision VVV
- If everything worked as expected, you should have a WordPress installation running on the following URL: https://one.wordpress.test. This is the WP site that we will use to install Sensei LMS.
To install Sensei LMS on your WordPress installation, you need to decide whether you will clone the Sensei LMS repository directly or your Sensei LMS fork. If you plan to contribute to Sensei LMS code base, it is recommended that you clone your fork. If needed, see this GitHub document on how to create a fork.
In your terminal:
- Go to the WordPress plugins directory:
$ cd ~/vvv-local/www/wordpress-one/public_html/wp-content/plugins/
- Clone the repository:
- If cloning Sensei LMS repository:
$ git clone git@github.com:Automattic/sensei.git
- If cloning your own fork replace
USER_NAME
with your GitHub username:
$ git clone git@github.com:USER_NAME/sensei.git
To install Sensei LMS dependencies (this includes some functionality that installs git pre-commit hooks for code style checks and Grunt that is used to generated minified versions of the SCSS and JS files):
$ cd ~/vvv-local/www/wordpress-one/public_html/wp-content/plugins/sensei
$ npm install
$ composer install
To generate JS and CSS assets run the following command from the Sensei LMS root directory:
npm run build:assets
To automatically rebuild the assets whenever a JS or SCSS file is modified run:
npm run start
Sensei LMS core has linting rules in place via pre-commit hooks to ensure code standards are used. Ensure you have installed NPM and Composer packages, so these are set up!
While developing, we recommend adding support to your editor for the following (most IDEs have plugins for this):
- phpcs
- eslint
- editorconfig
Sensei LMS is an open source online course plugin built for WordPress and lovingly crafted by Automattic and the Sensei LMS community ❤