A wrapper for scssphp to integrate scss compiling directly into Silverstripe
A wrapper for scssphp to integrate SCSS compiling directly into Silverstripe.
SCSS files are only compiled when needed, or when a ?flush
is done.
?flushstyles
) to regenerate CSS stylesheets (ie. force undetected SCSS changes with @import). Note: this only applies to sites in dev
mode. Alternatively use ?flush
to flush everything including stylesheets.*.scss
files into assets/_css/
and automatically modifies Requirements
paths$ThemeDir
(eg: url('#{$ThemeDir}/images/logo.png')
(see Configuration)live
mode (may require an initial ?flush
)editor.scss
files to TinyMCE (must be included in your front-end template)dev
mode only, can be disabledcomposer require axllent/silverstripe-scss
You need refer to your SCSS files by their full SCSS file names (eg:stylesheet.scss
).
<?php
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\View\Requirements;
class PageController extends ContentController
{
public function init()
{
parent::init();
Requirements::css('themes/site/css/stylesheet.scss');
// OR search for the scss in your $themeDirs
Requirements::themedCSS('css/stylesheet.scss');
}
}
The generated HTML will point automatically to the processed CSS file in assets/_css/
rather than the original SCSS file location, for example
<link rel="stylesheet" type="text/css" href="/assets/_css/themes-site-css-stylesheet.css?m=123456789" />
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem