lilweb / coffeescript-bundle

一个纯PHP实现的CoffeeScript资产过滤器

0.0.1 2013-10-31 10:44 UTC

This package is not auto-updated.

Last update: 2024-09-24 00:52:59 UTC


README

这是一个使用Assetic过滤器来使用CoffeeScript的Symfony2包。此包不需要Nodejs,因为CoffeeScript解释器是由@alxit实现的纯PHP版本。

安装

将包添加到您的 composer.json 文件中

...
"lilweb/coffeescript-bundle" : "0.0.1",
...

并将包添加到您的 AppKernel 文件中

new Lilweb\CoffeescriptBundle\LilwebCoffeescriptBundle()

使用方法

在您的twig文件中,使用 coffeescript 过滤器

{% javascripts filter="coffeescript"
     '@AcmeBundle/Resources/assets/coffee/main.coffee'
%}
     <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}