Local Development
To set up a local instance of Pressbooks, use the setup steps in our local-dev-environment repo. This approach uses Lando/Docker to to provision a local instance of Pressbooks for testing and development by open source contributors. This method will provide you with
- Unit testing via PHPUnit
- Code standards evaluation via PHP_CodeSniffer
- Build tools for plugin assets via npm
Note: This repo should not be deployed to production environments.
This repo already includes pressbooks/pressbooks, pressbooks/pressbooks-aldine, pressbooks/pressbook-book and a few other open source Pressbooks themes and plugins as Composer dependencies. If you would like to add additional plugins or themes to your local development environment, add them with the relevant composer require commands. For example, if you wanted to add the H5P plugin, you could use:
composer require wpackagist-plugin/h5p
Development Tools
Login:
The default Pressbooks username:password provided in the sample database is admin:admin
Logs:
Access and error logs are located on the VM in following directory:
/srv/www/example.com/logs/
Unit Testing and Coding Standards
Unit testing in the VM:
lando composer test
Read more about Unit Testing in Pressbooks
Coding standards in the VM:
lando composer standards
Asset Building
We use webpack wrapped in Laravel Mix to build plugin assets (CSS and JavaScript) for Pressbooks.
- At the command prompt from the Pressbooks plugin directory, e.g.
~/web/app/plugins/pressbooks, runnpm iornpm install --no-save pressbooks-build-toolsto install build tools. - To lint your Javascript and SCSS assets, run
npm run lint. - Then, run
npm run buildornpm run build:productionto build your plugin assets (npm run build:productionwill add a version hash to the asset manifest for browser cache busting).
Updating Plugins & Themes
In the terminal:
composer update pressbooks/pressbooks --with-dependencies
composer update pressbooks/pressbooks-aldine --with-dependencies
composer update pressbooks/pressbooks-book --with-dependencies