定制 axllent/silverstripe-scss 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

axllent/silverstripe-scss

最新稳定版本:2.1.2

Composer 安装命令:

composer require axllent/silverstripe-scss

包简介

A wrapper for scssphp to integrate scss compiling directly into Silverstripe

README 文档

README

A wrapper for scssphp to integrate SCSS compiling directly into Silverstripe.

SCSS files are only compiled when needed, or when a ?flush is done.

Features

  • Integrates scssphp seamlessly into Silverstripe
  • Includes flushing option (?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.
  • Writes processed *.scss files into assets/_css/ and automatically modifies Requirements paths
  • Allows custom global variables to be passed through to SCSS compiling (yaml configuration)
  • Basic support for $ThemeDir (eg: url('#{$ThemeDir}/images/logo.png') (see Configuration)
  • Automatic compression of CSS files when in live mode (may require an initial ?flush)
  • Adds any processed editor.scss files to TinyMCE (must be included in your front-end template)
  • Source maps (either inline or file) in dev mode only, can be disabled

Requirements

  • Silverstripe ^5 || ^6

Installation

composer require axllent/silverstripe-scss

Usage

You need refer to your SCSS files by their full SCSS file names (eg:stylesheet.scss).

Example

<?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" />

Further documentation

统计信息

  • 总下载量: 14.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 8
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-14