After installation, you will need to build the frontend assets using one of our build processes. The build steps are:
- Build the frontend assets, initially and when required during development
- Optional: add CSS customisation if your project demands
- Add/update theme configuration
- Run the standard Silverstripe dev/build when required
You can build the frontend in a variety of ways, depending on your build system toolkit.
The buildall
target script in package.json defines how distribution assets are created in a themes/app/frontend/dist
directory, which is automatically vendor-exposed upon installation of this module.
This module does not ship built assets in version control. Your deployment build process should create these for distribution.
node >= 18 / npm >= 8
npm --prefix ./vendor/nswdpc/waratah/themes/nswds/app/frontend run-script buildall
yarn --cwd ./vendor/nswdpc/waratah/themes/nswds/app/frontend run buildall
The build.sh shell script uses npm
on the system to run the buildall script:
./vendor/nswdpc/waratah/build.sh
If you see Error: npm is not installed on host
this means the script could not find npm on the system you are running the script on. The script expects npm
to be in the PATH environment variable.
For deeper integration into composer
, the project can use the following scripts to build on demand or after the project is created.
"scripts": {
"post-create-project-cmd": [
"NSWDPC\\Waratah\\Services\\Composer::postCreateProject"
],
"build-nswds": [
"NSWDPC\\Waratah\\Services\\Composer::buildDesignSystem"
]
}
The post-create-project-cmd
scripts will run after composer create-project
is called to assist with initial build.
When the module is updated or installed composer run-script build-nswds
should be run.
Both script targets run ./build.sh which expects npm to be available.
Once built, assets are available in the vendor/nswdpc/waratah/themes/nswds/app/frontend/dist
location. This path is vendor-exposed in composer.json
and automatically exposed when the module is installed.
After build you will notice a waratah-branding
directory in the project root. This is created by the build process and allows further branding customisation.
Development environments will automatically load non-minified assets.
Customisation can be added to waratah-branding/frontend/src/app.scss
via your own SCSS/CSS.
This is important if your project is applying co-branding. See Branding documentation for more information.
This is a once-only step during project creation.
Each Silverstripe project needs a theme configuration specified in the project's app
configuration file.
This change should be committed to version control. You can use your own naming scheme in the configuration file.
# app/_config/theme.yml
---
Name: app-theme
---
SilverStripe\View\SSViewer:
themes:
- 'nswdpc/waratah:nswds'
- '$default'
If you have a custom theme in your project that provides custom templates, specify that before nswdpc/waratah:nswds
# app/_config/theme.yml
---
Name: app-theme
---
SilverStripe\View\SSViewer:
themes:
- 'my-agency-theme'
- 'nswdpc/waratah:nswds'
- '$default'
The project will then prefer templates from themes/my-agency-theme/templates
.
After building the assets, run a dev/build and a flush in the normal Silverstripe way:
./vendor/framework/sake dev/build flush=1
Depending on your project, you may also need to bypass/flush your browser cache.
When updating the module, project modules or your project requirements in waratah-branding
as you develop, simply run the required build steps.
If you are co-branding or more, read further branding customisation