定制 ikkez/f3-assets-sass 二次开发

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

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

ikkez/f3-assets-sass

最新稳定版本:1.0.6

Composer 安装命令:

composer require ikkez/f3-assets-sass

包简介

SASS addon for the Assets plugin for PHP Fat-Free Framework

README 文档

README

This is an extention to add a SASS/SCSS compiler to the existing Assets Management plugin for the PHP Fat-Free Framework.

Install

When you have F3-Assets already up and running, just run composer require ikkez/f3-assets-sass. In case you do not use composer, copy the assets/ folder into your AUTOLOAD path, install scssphp/scssphp separately and you should be ready to go.

Usage

To register the sass compiler, just add this line to your view controller, or where ever you have put the initialisation of the main assets plugin.

// register sass handler \Assets\Sass::instance()->init();

Within your templates you can then easily use .scss files directly, as it would be normal css files.

<link rel="stylesheet" href="scss/main_styles.scss">

That's it. Compilation, minification and concatenation with other files is now handled by the assets plugin. The base directory of the sass file can also be used as import path, so using @import within your sass file can be used to load other relative sass files. So recompiling a whole bootstrap frontend is not problem:

<link rel="stylesheet" href="components/MDBootstrap/sass/mdb.scss">

The only drawback with @include files is, that changes to those files are currently not detected automatically, so the whole main sass file does not update on the fly. However, you can add the watch attribute and define one or multiple paths to scan for file changes - wildcards are possible:

<link rel="stylesheet" href="components/MDBootstrap/sass/mdb.scss" watch="custom.scss"> <link rel="stylesheet" href="components/MDBootstrap/sass/mdb.scss" watch="custom.scss, addons/*.scss">

NB: The watch-attribute should only be considered while working on the files, because scanning for file modification times isn't necessary for production-ready styles and would, depending on the amount of files to scan, slow things down. If you need to refresh files on a production environment, it's recommended to clear the temp files with \Assets::instance()->clear();, instead of proactive looking for changes.

If you like to add sass files programmatically, you should simply treat them like normal css files:

$opt = [ 'watch'=>'ext/*.scss' ]; \Assets::instance()->add('scss/main_styles.scss', 'css', 'head', 5, NULL, $opt);

License

GPLv3

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固