项目作者: DorsetDigital

项目描述 :
Extension of SilverStripe's requirements to allow for adding scripts and CSS inline from files
高级语言: PHP
项目地址: git://github.com/DorsetDigital/silverstripe-requirementsinline.git
创建时间: 2018-07-02T09:30:47Z
项目社区:https://github.com/DorsetDigital/silverstripe-requirementsinline

开源协议:BSD 3-Clause "New" or "Revised" License

下载


silverstripe-requirementsinline

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():

  1. <?php
  2. use DorsetDigital\SilverstripeRequirements\RequirementsInline;
  3. class MyPageController extends PageController
  4. {
  5. public function init()
  6. {
  7. parent::init();
  8. RequirementsInline::themedJavascript('homescript');
  9. RequirementsInline::themedCSS('homestyles');
  10. }
  11. }