troopers/assetic-injector-bundle
最新稳定版本:1.1.3
Composer 安装命令:
composer require troopers/assetic-injector-bundle
包简介
This bundle allow you to define global javascripts and stylesheets
README 文档
README
=============
AsseticInjectorBundle
Description
The AsseticInjectorBundle allows you to automatically include javascripts and stylesheets anywhere in your project.
This bundle will scan every registered bundles and search for an assetic_injector.json file. From this file, the injector will collect the resources and inject them into the assetic engine. To include them, you have to define a tag (foot, head, custom, ... actually the one you choose) and add the tag in the wanted assetic block.
Install
With Composer :
Add this line in your composer.json file :
"troopers/assetic-injector-bundle": "~1.0"
Declare the bundle in your AppKernel.php:
public function registerBundles() {
$bundles = array(
[...]
new Troopers\AsseticInjectorBundle\TroopersAsseticInjectorBundle(),
[...]
How it works
.. Declare an assetic_injector.json in the Resource/config folder of your application or bundle.
Within this file, list all the tags and the correspondant resource to inject :
{
"require_all":
{
"javascripts":
{
"head": "@MyBundle/Resources/public/js/myscript.js"
},
"stylesheets":
{
"head": "@MyBundle/Resources/public/css/mystyle.css"
}
}
}
.. Include the correspondant tag in your assetic's block with the code : injector="tag"
i.e :
{% javascripts injector="head"
'@MyAcmeDemoBundle/Resources/public/jsloremipsumdolorsitamet.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
.. Results
The resource associated to the tag is injected with assetic_injector.json.
i.e :
{% javascripts injector="head"
'@MyAcmeDemoBundle/Resources/public/jsloremipsumdolorsitamet.js'
'@MyBundle/Resources/public/js/myscript.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
Enjoy !
No more needs to include javascript or stylesheets from assetic injector's ready bundles ! Just add the tag and here you are !
troopers/assetic-injector-bundle 适用场景与选型建议
troopers/assetic-injector-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25.26k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2016 年 10 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「assetic」 「injector」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 troopers/assetic-injector-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 troopers/assetic-injector-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 troopers/assetic-injector-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Course Hero's Assetic tools bundle
Inject dependencies into constructors and methods
The simplest [in]dependency injection container for PHP7, compatible with PSR-11.
An implementation of dependency injection (like RequireJS) in PHP.
Dependency Injection for PHP
Bundle to Help Migrating From Assetic to Webpack
统计信息
- 总下载量: 25.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-03
