dorsetdigital/silverstripe-requirementsinline

This package is abandoned and no longer maintained. The author suggests using the https://github.com/DorsetDigital/silverstripe-enhanced-requirements package instead.

Provides a mechanism to inline javscript and css from external files

Installs: 130

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

v1.0 2018-07-03 12:28 UTC

This package is auto-updated.

Last update: 2021-06-14 10:31:37 UTC


README

Please note: This module is no longer in active development. The functionality which this module provides can now be found in the following module:

https://github.com/DorsetDigital/silverstripe-enhanced-requirements

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.

Scrutinizer Code Quality Build Status License Version

Requirements

  • Silverstripe 4.x

Installation

  • Install the code with composer require dorsetdigital/silverstripe-requirementsinline
  • Run a dev/build?flush to update your project

Usage

Use 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');
 }
}