cypresslab/less-elephant-bundle
Composer 安装命令:
composer require cypresslab/less-elephant-bundle
包简介
Integrates LessElephant into Symfony2
README 文档
README
A Bundle to use the LessElephant library in a Symfony2 project.
This bundle scans your less projects on every request, and checks if they needs to be recompiled. It takes care of dependencies, so you can use less with @import without problems. You don't need javascript or manual excution of lessc anymore
Integrate bootstrap in Symfony2 and compile less on the fly
Configuration
Add the configuration in your config file (for the dev environment)
app/config_dev.yml
cypress_less_elephant:
less_binary_path: "/usr/local/bin/lessc"
less_projects:
my-first-project:
source_folder: %kernel.root_dir%/../src/Cypress/DemoBundle/Resources/public/bootstrap/less
source_file: bootstrap.less
destination_css: %kernel.root_dir%/../src/Cypress/DemoBundle/Resources/public/bootstrap/css/bootstrap.css
another-project:
.....
force_compile: ~
less_binary_path (optional) is the path to your lessc binary. LessElephant try to find it with "which lessc". So, if you are on windows, you need this
less_projects (at least 1) define an entry for each of your less projects. All three parameters are mandatory
-
source_folder the folder where all your less files resides
-
source_file the main less file. Usually this is a file that contains many @import directive
-
destination_css the destination css. This file needs to be writable by web server user (for example on linux www-data)
force_compile (optional) default: false. If it is true, we force the compilation for each request.
Add the stylesheets to your templates
assetic
{% stylesheets filter="yui_css" "@CypressDemoBundle/Resources/public/bootstrap/css/bootstrap.css" %} <link href="{{ asset_url }}" type="text/css" rel="stylesheet" /> {% endstylesheets %}
without assetic
<link href="{{ asset('bundles/cypressdemo/bootstrap/css/bootstrap.css') }}" type="text/css" rel="stylesheet" />
Enjoy!
How it works
This bundle register an event listener that, on every request, check if the projects defined in the config_dev.yml files are in "clean" state or needs recompile.
If the project do not need to be recompiled, it adds a really small overhead to symfony, just the time to check a bunch of files.
Read the LessElephant readme for other useful informations
cypresslab/less-elephant-bundle 适用场景与选型建议
cypresslab/less-elephant-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.66k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2012 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「assets」 「css」 「less」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cypresslab/less-elephant-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cypresslab/less-elephant-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cypresslab/less-elephant-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Asset Management for PHP
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
Tool for loading or deploying CSS and JS files into web pages
统计信息
- 总下载量: 5.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL3
- 更新时间: 2012-04-11