Provides a mechanism to inline javscript and css from external files
Extension of SilverStripe's requirements to allow for adding scripts and CSS inline from files
Silverstripe provides a number of ways to add Javascript and CSS to your pages, but currently doesn't allow you to add inline code from external files.
This module is a simple way to do this, meaning that you can keep your inline scripts and CSS in separate files to help with your build process, but take advantage of using them inline where needed.
composer require dorsetdigital/silverstripe-requirementsinline
dev/build?flush
to update your projectUse the methods in the same way as the standard Requirements
methods for themedCSS()
and themedJavascript()
:
<?php
use DorsetDigital\SilverstripeRequirements\RequirementsInline;
class MyPageController extends PageController
{
public function init()
{
parent::init();
RequirementsInline::themedJavascript('homescript');
RequirementsInline::themedCSS('homestyles');
}
}
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