websemantics/lcss2php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

websemantics/lcss2php

最新稳定版本:1.0.4

Composer 安装命令:

composer require websemantics/lcss2php

包简介

Conveniently extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

README 文档

README

 ╭────────▞────────╮ │ │ │ ╭─────────╮ │ │ │ │ │ ┬ ╭─╮╭─╮╭─╮ ╭─╮╭─╮╭─╮╭─╮ ┃ │ ░ ░░░ │ ┃ ┬╭─╮ ╭─╮┬ ┬╭─╮ ╭─╮┬ ┬╭─╮ │ ├┤ ╰─╮╰─╮ ╰─╮│ ╰─╮╰─╮ ┃ │ ░░░░░ │ ┃─┤├─╯ ├─╯├─┤├─╯ ├─╯├─┤├─╯ ┴─╯╰─╯╰─╯╰─╯ ╰─╯╰─╯╰─╯╰─╯ ┃ ╰─────────╯ ┃ ┴┴ ┴ ┴ ┴┴ ┴ ┴ ┴┴ ╭──────────────────────────────────┤ ├──────────────────────────────────╮ │ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ │ ▯ ▯ ▯ ▯ ▯ ▯ │ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ │ ╰──┬┬─────┬┬─────┬┬─────┬┬─────┬┬──┤ ├───┬┬─────┬┬─────┬┬─────┬┬─────┬┬─╯ ││ ││ ││ ││ ││ │ ╭───╮ │ ││ ││ ││ ││ ││ ───┤├─────┤├─────┤├─────┤├─────┤├──┤ │───│ ├───┤├─────┤├─────┤├─────┤├─────┤├──── ─┴┴ ─ ┴┴ ─┴┴ ─ ┴┴─ ─┴┴ │ │ │ │ ┴┴ ─ ─┴┴─ ┴┴─ ─┴┴ ─ ┴┴─ ╰──────╯ ╰──────╯ 

A straightforward library that extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

Install

1- Use Composer to install as follows,

composer require websemantics/lcss2php

Getting Started

Pass a list of files (Less, Scss or a mix ) to a newly created instance of Lcss2php class. Get a list of all the variables using the all method.

$files = ['/usr/etc/variables.less', '/usr/etc/_variables.scss']; $lcss2php = new Lcss2php($files); $variables = $lcss2php->all();

By default all variable types are returned, for example, Color, Dimension, etc. You can use the ignore function to filter some types from the final variables list,

$variables = (new Lcss2php($files))->ignore(['Color', 'Dimension'])->all();

Notice that, there are two different variable types for each lanaguage (Less, Scss). For a list of all the types, check class Type at lcss2php/src/Node/Type.php.

Example

Quick run of what to expect; take this Scss example code,

$green: #24ce7b !default; $blue: #38b5e6 !default; $orange: #f48714 !default; $red: #f6303e !default; $brand-success: $green; $brand-info: $blue; $brand-warning: $orange; $brand-danger: $red; $spacer: 1rem !default; $spacer-x: $spacer !default; $spacer-y: $spacer !default;

Will be converted to,

[ "green" => "#24ce7b"  "blue" => "#38b5e6"  "orange" => "#f48714" "red" => "#f6303e" "brand-success" => "#24ce7b" "brand-info" => "#38b5e6" "brand-warning" => "#f48714" "brand-danger" => "#f6303e" "spacer" => "1rem" "spacer-x" => "1rem" "spacer-y" => "1rem" ]

Support

Star ⭐ this repository if you find this project useful, to show support or simply, for being awesome :)

Need help or have a question? post at [StackOverflow](https://stackoverflow.com/questions/tagged/lcss2php websemantics).

Please don't use the issue trackers for support/questions.

Contribution

Contributions to this project are accepted in the form of feedback, bugs reports and even better - pull requests.

Open Source

These project have been used in the making of this project, thanks you!

License

MIT license Copyright (c) Web Semantics, Inc.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固