我将 Assetic 与 Twig 一起使用,但不是 symfony2 框架。
这是项目的设置方式
/site
/template
/css
/public_html
/css
原始 css 存储在下面/site/template/css
,我希望资产缩小 css 并将其输出到/public_html/css
.
这是将资产设置为树枝扩展的方式
$factory = new AssetFactory(//absolute path to `/site/template/`);
$factory->setDefaultOutput(//absolute path to `/public_html/`);
$factory->setDebug(false);
$twig->addExtension(new AsseticExtension($factory));
然后在我的模板中:
{% stylesheets 'css/screen.css' output='css/*' %}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endstylesheets %}
我可以看到assetic在最终输出中生成了一个唯一的url:
<link href="css/00da241.css" type="text/css" rel="stylesheet" />
但是,如果我查看/public_html/css
,文件永远不会生成!
我正在使用带有 apache 的 Windows 7 服务器,PHP 在任何地方写入文件都没有问题。
这可能是什么原因造成的?