承接 armin/scssphp-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

armin/scssphp-bundle

Composer 安装命令:

composer require armin/scssphp-bundle

包简介

Symfony bundle to parse scss sources at runtime.

README 文档

README

This bundle for Symfony Framework (4-6), includes the scssphp/scssphp package, which allows you to parse SCSS sources (like Bootstrap) in your application, without need of Node.js and npm!

The ScssPHP bundle can recognize changes in SCSS source files (or Symfony configuration) automatically and only re-compiles those files. So, when you change something in your SCSS sources and refresh the application you see the results, instantly. You can disable this for the production environment.

Also, it provides a helpful debugger toolbar entry and a command which allows you to compile the SCSS sources from CLI.

It is released under MIT license.

Features

  • Compile SCSS sources (like the Bootstrap framework) with pure PHP (thanks to scssphp/scssphp)
  • Simple but powerful asset configuration (e.g. set variable values)
  • Several output-formatter available (nested, compressed, crushed, etc.)
  • Inline source map support
  • Profiler Toolbar Debugging
  • Symfony Command to compile SCSS sources on CLI
  • Auto-update, when sources (or configuration) changes

Screenshots

ScssPHP in Symfony's profiler toolbar:

ScssPHP in Symfony's profiler toolbar

Hovering over ScssPHP profiler toolbar entry:

Hovering over ScssPHP profiler toolbar entry.

ScssPHP profiler panel:

ScssPHP profiler panel.

Display of SCSS compiling errors:

Display of SCSS compiling errors.

Details of recent SCSS builds:

Details of recent SCSS builds

CLI command (with compiling error)

$ php bin/console scssphp:compile

CLI command (with compiling error)

Non-interactive CLI command

$ php bin/console scssphp:compile all -n

Non-interactive CLI command

Installation

To install the scssphp-bundle you can just use composer:

$ composer require armin/scssphp-bundle

The bundle also ships a Symfony Flex Recipe.

Usage and configuration

The scssphp bundle is triggered, when you use the {{ asset("...") }} function in your Twig templates, and the requested asset is configured in scssphp.assets and scssphp.enabled is true.

Example asset call in twig:

<link href="{{ asset('css/styles.css') }}" rel="stylesheet">

Example configuration

For this example you also need to require the Bootstrap CSS framework:

$ composer require twbs/bootstrap:"^5.0"
# config/packages/scssphp.yaml
scssphp:
    enabled: true
    assets:
        "css/styles.css":
            src: "assets/main.scss"
            sourceMap: true
            importPaths:
                - "vendor/twbs/bootstrap/scss"
            variables:
                primary: '#ff0066'

Reference

# On CLI: php bin/console config:dump scssphp

# Default configuration for extension with alias: "scssphp"
scssphp:

    # When disabled, ScssPHP will not compile SCSS sources automatically, 
    # by user's request. Compiling with CLI tool will still work.
    enabled:              true

    # Automatically re-compile SCSS sources on updates, when enabled.
    autoUpdate:           true

    # List of SCSS assets, which should be compiled, when requested. Key is the asset name/path.
    assets:
        -
            # Path to SCSS source file (entrypoint), relative to Symfony's project directory.
            src:                  ~ # Required

            # Prepends this outputFolder to asset's destination path.
            outputFolder:         public

            # Array of import paths, relative to Symfony's project directory.
            importPaths:          []

            # Array of scss variables, which should be used during compilation. Use key => value here.
            variables:            []

            # Expanded or compressed CSS output.
            outputStyle:          compressed
            # One of: 
            # - "expanded"
            # - "compressed"

            # When enabled, the CSS file contains inline sourceMap comments.
            sourceMap:            false

            # When enabled, the timestamp of the asset, will be appended as query string.
            appendTimestamp:      true

Upgrade notice

Since version 2.0 the option "formatter" has been replaced by "outputStyle", which may have got values "expanded" or "compressed" (default).

Support

If you like this Symfony bundle, you can donate some funds to support further development. Thank you!

For help please visit the issue section on Github.

armin/scssphp-bundle 适用场景与选型建议

armin/scssphp-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.45k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 07 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 armin/scssphp-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 armin/scssphp-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 armin/scssphp-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-20