splitbrain/lesserphp 问题修复 & 功能扩展

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

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

splitbrain/lesserphp

Composer 安装命令:

composer require splitbrain/lesserphp

包简介

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

README 文档

README

LesserPHP is a compiler for LESS written in PHP. It is based on lessphp by @leafo. The original has been abandoned in 2014. The fork by @MarcusSchwarz has been mostly abandoned in 2021. There are other forks with dubious status.

This is an opinionated fork with the goal to modernize the code base enough to be somewhat easier to maintain without completely rewriting it. It is meant to be used as a stable base for DokuWiki. This means features not needed for this goal are removed.

Please note that this fork is based on the 0.6.0-dev branch of MarcusSchwarz/lesserphp, not the much modernized master branch. This has two reasons:

  1. The master was not up-to-date with all the bug fixes in the 0.6.0-dev branch (some of which had been contributed by DokuWiki developers)
  2. I simply only noticed the considerable refactoring Marcus had done in the master branch after I had already started my own refactoring. I did not want to start over again. His approach is much more radical than mine and probably took more than the long weekend I had available for this.

Contributing and Bugs

Please report bugs to the issue tracker. Fixes are only likely when DokuWiki needs them, or you provide a pull request.

Feature Requests will be ignored unless accompanied by a pull request.

How to use in your PHP project

Don't. You really wouldn't want to start a new project using LESS. It simply seems that SASS has won the battle. Or maybe even skip the whole CSS preprocessor thing - modern CSS is quite powerful on its own.

If you are already using lessphp in one of it's many forks, using this one isn't too different.

You can still look at the original documentation for the most part. The API is mostly the same. Refer to the upstream documentation the bundled Documentation for the LESS syntax itself. Keep in mind that some more modern features are not supported by LesserPHP.

To install it, use composer:

composer require splitbrain/lesserphp

The typical flow of LesserPHP is to create a new instance of Lessc, configure it how you like, then tell it to compile something using one built in compile methods.

The compile method compiles a string of LESS code to CSS.

<?php
require __DIR__ . '/vendor/autoload.php';

$less = new LesserPHP\Lessc;
echo $less->compile(".block { padding: 3 + 4px }");

The compileFile method reads and compiles a file. It will either return the result or write it to the path specified by an optional second argument.

<?php
echo $less->compileFile("input.less");

If there's any problem compiling your code, an exception is thrown with a helpful message:

<?php
try {
  $less->compile("invalid LESS } {");
} catch (LesserPHP\ParserException $e) {
  echo $e->getMessage();
}

splitbrain/lesserphp 适用场景与选型建议

splitbrain/lesserphp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.71k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 splitbrain/lesserphp 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 514
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-29