icedream / javascriptpackerbundle
此包已被废弃,不再维护。未建议替代包。
Dean Edwards Packer,可用于Symfony2
1.0.0
2014-06-15 15:34 UTC
Requires
- kriswallsmith/assetic: >=1.1
Suggests
- meenie/javascript-packer: Keep track of the Packer PHP port using Composer
This package is not auto-updated.
Last update: 2020-01-20 03:52:07 UTC
README
此包允许您使用Dean Edward's Packer的PHP版本压缩JavaScript。
测试版免责声明
您可以自由使用此包,但请注意它仍在测试版阶段,需要一些测试。如果您在此包中发现任何问题,请使用GitHub问题跟踪器提供反馈。
安装/使用
-
通过composer安装
composer require icedream/javascriptpackerbundle:~1.0@beta
-
下载Dean Edward's packer的PHP版本。推荐方法是使用此包的建议,通过composer安装
meenie/javascript-packer
。composer require meenie/javascript-packer:~1.1
-
将包添加到应用程序内核(
app/AppKernel.php
)<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Icedream\JavaScriptPackerBundle\JavaScriptPackerBundle(), ); // ... } }
-
在
app/config/config.yml
中配置包# Assetic Configuration assetic: filters: jspacker: resource: %kernel.root_dir%/../vendor/icedream/javascriptpackerbundle/Icedream/JavaScriptPackerBundle/Resources/config/services.xml # If you did not use the composer method to download the Packer script, uncomment this and point the variable to the full path of class.JavaScriptPacker.php #packer: %kernel.root_dir%/../vendor/meenie/javascript-packer/class.JavaScriptPacker.php
-
现在您可以根据需要使用过滤器。
{% javascripts '@AcmeDemoBundle/Resources/public/js/somescript.js' filter='jspacker' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %}
许可
此包遵循MIT许可证。有关更多信息,请参阅LICENSE.txt。