PHPackages                             zauberfisch/silverstripe-better-requirements - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zauberfisch/silverstripe-better-requirements

ActiveSilverstripe-module[Utility &amp; Helpers](/categories/utility)

zauberfisch/silverstripe-better-requirements
============================================

Replacement for the SilverStripe Requirements\_Backend

1.0.0(8y ago)45281[3 PRs](https://github.com/Zauberfisch/silverstripe-better-requirements/pulls)BSD-3-ClausePHP

Since May 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Zauberfisch/silverstripe-better-requirements)[ Packagist](https://packagist.org/packages/zauberfisch/silverstripe-better-requirements)[ Docs](https://github.com/Zauberfisch/silverstripe-better-requirements)[ RSS](/packages/zauberfisch-silverstripe-better-requirements/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

SilverStripe Requirements Backend replacement
=============================================

[](#silverstripe-requirements-backend-replacement)

Work in progress
----------------

[](#work-in-progress)

This module is still work in progress and a hack-ish replacement for the SilverStripe Requirements Backend. This module exists because of current limitations in SilerStripe Requirements and might change its API or be completely obsolete once Requirements are re-factored.

Current Features
----------------

[](#current-features)

- compile sass/scss files using sassc (libsass)
- compile less files using less.php

Installation
------------

[](#installation)

#### Requirements for using sassc

[](#requirements-for-using-sassc)

- \*nix based system. Windows Servers currently not supported
- php needs to be able to shell execute commands
- php needs write permissions to the css files and the combined\_files folder
- sassc needs to be installed on your system If your sassc executable is not in any of the paths, you can set the constant SS\_SASSC\_PATH (`define('SS_SASSC_PATH', '/path/to/sassc')`).

#### Requirements for using less

[](#requirements-for-using-less)

- the composer package `leafo/lessphp`

#### Installing the module

[](#installing-the-module)

1. Install the module using composer or download and place in your project folder
2. Run `?flush=1`

#### Installing sassc

[](#installing-sassc)

If your system does not have sassc installed, you will need to install this as well. At time of writing this, I know of no existing package or pre-compiled binary, so you either have to [compile it yourself](http://libsass.org/#sassc) or use Zauberfisch's [semi-regularly build (debian)](http://easy.zauberfisch.at/vagrant/sassc)(this link might change in the future).

(Note: on shared web hosting it might not be possible to use sassc, but on some it will work to upload the binary to your project folder and set `define('SS_SASSC_PATH', BASE_PATH . '/sassc')`)

Usage
-----

[](#usage)

By itself, this module does nothing. You will have to set the backend for Requirements. A good place to do this is in `PageController->init()` but can be at any other place as well. Just make sure you set the backend before you use any other Requirements methods.

```
class PageController extends \SilverStripe\CMS\Controllers\ContentController {
	// ...

	public function init() {
		Requirements::set_backend(new \BetterRequirements\Backend());
		parent::init();

		// ...
	}

	// ...
}

```

After this, you can use Requirements just the same as you did before, with one addition: You can require sass/scss/less files.
The backend will replace 'sass'/'scss'/'less' in the file path and append '.css'.

```
// create and require mysite/css/myfile.scss.css
\SilverStripe\View\Requirements::css(project() . '/scss/myfile.scss');
// will create and require mysite/css/otherfile.sass.css
\SilverStripe\View\Requirements::css('mysite/sass/otherfile.sass');
// will create and require themes/mytheme/css/myfile.less.css
\SilverStripe\View\Requirements::css($this->ThemeDir() . '/less/myfile.less');
// it also works with combined files and mixed file types:
\SilverStripe\View\Requirements::combine_files('main.css', [
	project() . '/css/normal-file.css',
	project() . '/scss/scss-file.scss',
	project() . '/less/less-file.less',
	project() . '/scss/main.scss',
	project() . '/less/main.less',
]);

```

#### Compiling/Preprocessing

[](#compilingpreprocessing)

Compiling/Preprocessing will take place when one of the following conditions is met:

- `?flush=1` (will re-compile all files)
- config `\BetterRequirements\Backend.compile_in_live`
- Site is in dev mode and config `\BetterRequirements\Backend.compile_in_dev` is true

You can change the configuration for this in a yml config file:

```
\BetterRequirements\Backend:
  compile_in_live: true # default: false
  compile_in_dev: true # default: true

```

**Should you experience a long dalay until files get compiled after you change them, try to change the cache key to md5\_file, then the file check will actually consider the content rather thant he file timestamp:**

```
\BetterRequirements\Backend:
  cache_key_method: 'md5_file' # default: 'filemtime'

```

Notes
=====

[](#notes)

When compiling your sass/scss files both locally (dev) as well as on your server (eg automated after deployment), it is recommended to add your css files to .gitignore and exclude them from version control.

Composer is currently not compatible with sassc, however there is a workaround: Composer is a mix of ruby and sass, you can use the sass part with sassc and will only loose a small list of features (image-height, image-width, sprite functions, ...). Get the compass mixins from [Igosuki/compass-mixins](https://github.com/Igosuki/compass-mixins) and see Zauberfisch's [SilverStripe Boilerplate](https://github.com/Zauberfisch/silverstripe-boilerplate/tree/dev) for example usage.

License
-------

[](#license)

```
Copyright (c) 2015, Zauberfisch
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
	* Redistributions of source code must retain the above copyright
	  notice, this list of conditions and the following disclaimer.
	* Redistributions in binary form must reproduce the above copyright
	  notice, this list of conditions and the following disclaimer in the
	  documentation and/or other materials provided with the distribution.
	* Neither the name Zauberfisch nor the names of other contributors may
	  be used to endorse or promote products derived from this software
	  without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3280d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/186158?v=4)[zauberfisch](/maintainers/zauberfisch)[@Zauberfisch](https://github.com/Zauberfisch)

---

Top Contributors

[![Zauberfisch](https://avatars.githubusercontent.com/u/186158?v=4)](https://github.com/Zauberfisch "Zauberfisch (7 commits)")

---

Tags

silverstripesassscssless

### Embed Badge

![Health badge](/badges/zauberfisch-silverstripe-better-requirements/health.svg)

```
[![Health](https://phpackages.com/badges/zauberfisch-silverstripe-better-requirements/health.svg)](https://phpackages.com/packages/zauberfisch-silverstripe-better-requirements)
```

###  Alternatives

[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[nizsheanez/yii2-asset-converter

Less, Sass, Scss and Phamlp converter for Yii2. No system requires. yii2-composer support, Less autoupdate, customizing of output directory

64167.5k6](/packages/nizsheanez-yii2-asset-converter)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[markstory/mini-asset

An asset compression library. Provides file concatenation and a flexible filter system for preprocessing and minification.

66741.1k3](/packages/markstory-mini-asset)[efficiently/larasset

Larasset is a library for Laravel 5 which manage assets in an easy way.

684.8k](/packages/efficiently-larasset)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
