websemantics/lcss2php
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/Scsssources and returns aPHPassociative 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!
- SCSS Compiler, SCSS compiler written in PHP.
- LESS Compiler, Less.js ported to PHP.
License
MIT license Copyright (c) Web Semantics, Inc.
websemantics/lcss2php 适用场景与选型建议
websemantics/lcss2php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 60.04k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 11 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sass」 「scss」 「less」 「laravel」 「pyrocms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 websemantics/lcss2php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 websemantics/lcss2php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 websemantics/lcss2php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Zend Framework 3+ module that provides assets bundling / caching
bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.
Laravel React Boilerplate
A performance-focused, drop-in compatible fork of scssphp/scssphp (a SCSS compiler written in PHP).
Selectize Theme for Bootstrap 4
This package help you to easily setup your project.
统计信息
- 总下载量: 60.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 34
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-23