This package is abandoned and no longer maintained. No replacement package was suggested.

A convenience module enforcing best practices for using Requirements

dev-master 2016-04-14 08:30 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:38:52 UTC


This is a convenience module enforcing best practices for using Requirements.


  • Combine a mixed list of JS / CSS assets using a single method.
  • Access to the $this->theme_dir variable in your page controllers.

SvdRequirements will seperate the js from the css files, and combine them for each controller.


  1. Install using composer: composer require "svandragt/silverstripe-svdrequirements:*"

Example: you might have a Page and HomePage extends Page class, each with dozen JS and CSS requirements. Add SvdRequirements::combine($assets); to each init method.


In our example the site will now have the following files:


Quick access to theme folder

This optional SvdRequirementsExtension (enabled by default) adds a shortcut to the theme folder by setting a $theme_dir property to the Page_controller which you can access through $this->theme_dir - which would return 'themes/simple' for example.

You can convert the simple theme to use requirements in 2 steps:

  1. Remove all calls to CSS and JS from the templates.
  2. to the Page's init() method add the following code:
$assets = array(

I keep a list of known bugs.