hydrawiki/lessoid
Composer 安装命令:
composer require hydrawiki/lessoid
包简介
A persistent Less.js RESTful API parser service using Node.js.
README 文档
README
A LESS parser running as a Node.js RESTful API and implements the official Less.js package.(See notes below.) It is intended as a replacement for the oyejorge/less.php package and works as a drop in replacement for MediaWiki. It can be used for other projects.
Why LESSoid?
In the Hydra Wiki Farm, the default LESS.php parser doesn't play well with caching across shared file systems such as gluster and relies on slow file caching techniques. This Node.js solution uses an in-memory cache and can share the cache to multiple web nodes using Redis.
As for the name, we figured it matched MediaWiki's naming conventions. Parsoid, Mathoid... Why not LESSoid?
LESSoid versus LESS.php
PROS
- Initial benchmarks show significant performance increases for parsing and high concurrency situations.
- Once the code enters a beta stage we will release official benchmarks.
- New Less.js releases can be implemented immediately to get new features and bug fixes.
- Initial benchmarks show significant performance increases for parsing and high concurrency situations.
CONS
- Installations on shared hosts that can not run LESSoid as a service will fall back to invoking lessc from the command line. The lessc fall back will be slower then less.php in most situations.
How does it work?
The LESSoid package presents a Less_Parser class that is compatible with the less.php class of the same name. Existing projects should be able remove the existing less.php package and instead include lessoid package. If there are compatibility problems please report the issue.
All file includes, variables, and other required pieces are funnelled through a RESTful API request to the LESSoid service running localhost which return the compiled CSS as a JSON response. If the LESSoid service is not running then it will automatically fall back to invokving lessc through the command line. The lessc fall back prevents the loss of CSS on a site, but can be as slow as less.php.
Requirements
- PHP 7.0+
- Node.js 4+
- A process manager service such as supervisord, god, launchctl, or otherwise. A god configuration example is provided.
- Alternativly, if you don't already have a process manager service in place, PM2 is a fantastic and user friendly process manager that works great with LESSoid.
- Your poject's code checkout that contains all necessary LESS, CSS, and other requirements must be present on the server as the LESSoid service.
How to use
Installation through composer into your project:
composer require hydrawiki/lessoid
Without composer, download the latest release from the GitHub project and place it in an appropriate place in the project. (https://github.com/HydraWiki/lessoid/releases)
Please note: This is incompatible with oyejorge/less.php, so please make sure you (or composer) are not requiring it!
Configuration
- In
lib/config.defaults.iniyou will find the configuration for the MediaWiki shim that interfaces MediaWiki with LESSoid.- It's best not to modify this file, but instead create a
lib/config.inifile and put any settings overrides in it, so that future updates won't undo your configuration changes.
- It's best not to modify this file, but instead create a
- In
services/lessoid/config.jsonyou will find configuration options for the LESSoid service its self. They should all mostly be pretty self explanatory at this point.
Current Development Status
This is alpha level code and the first target is to work seamlessly with MediaWiki. There are various configuration settings that need to be implemented properly so it works not only seamlessly on MediaWiki, but on on frameworks as well.
For MediaWiki implementation, It currently implements a Less_Parser class that mimics the Less_Parser class from Less.php that MediaWiki uses by deault. It works great, but could probably be made cleaner if not having to drop directly into MediaWiki.
Other Notes
We are currently using Less.js version 3.9.0 with a small modification to make it friendlier in a MediaWiki environment. In the future we plan to eliminate this modification and have it user upgradeable through node package manager.
hydrawiki/lessoid 适用场景与选型建议
hydrawiki/lessoid 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 517 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「css」 「less」 「stylesheet」 「less.js」 「lesscss」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hydrawiki/lessoid 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hydrawiki/lessoid 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hydrawiki/lessoid 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
ZF2 module that allows automation of compiling your LESS with the extra of minifying the files.
Zend Framework 3+ module that provides assets bundling / caching
Define your own css rule-sets for the TYPO3 CMS backend.
A performance-focused, drop-in compatible fork of scssphp/scssphp (a SCSS compiler written in PHP).
统计信息
- 总下载量: 517
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-11-29