【问题标题】:Symfony2 - auto install assets on NetbeansSymfony2 - 在 Netbeans 上自动安装资产
【发布时间】:2012-12-21 18:36:29
【问题描述】:

现在当我测试我的应用程序时,我需要在 netbeans 上运行命令:

assets:install 

我讨厌一遍又一遍地做事……因为 symfony2 需要运行这个命令来把修改后的文件放到正确的路径中。

有没有办法运行该命令或更改配置文件?

使用 --symlink 我收到此消息:

  [InvalidArgumentException]                                                                                            
  The symlink() function is not available on your system. You need to install the assets without the --symlink option.  

解决了!

我的 Windows 版本 (XP) 不支持 --symlink。我找到了一个适用于 Windows 的 Link shell 扩展,可以做到这一点。 这是程序和文档,非常好用!

Link Shell Extension

谢谢大家,很有帮助。

【问题讨论】:

  • Symfony 使用符号链接,因此您无需在每次修改文件时都运行该命令。
  • 要为每个包创建符号链接而不是复制其资产,请使用--symlink 选项
  • symlink() 函数在您的系统上不可用。您需要安装不带 --symlink 选项的资产。 [无效参数异常]
  • @Patrick 您运行的是 Vista 之前的 Windows 版本吗? php.net/manual/en/function.symlink.php
  • @cheesemacfly 我用的是 XP,有问题吗?

标签: php html css symfony assets


【解决方案1】:

您可以在assets:install 命令上使用--symlink 开关:

$ php app/console assets:install -h
Usage:
 assets:install [--symlink] [--relative] target

Arguments:
 target      The target directory (usually "web")

Options:
 --symlink   Symlinks the assets instead of copying it
 --relative  Make relative symlinks

Help:
 The assets:install command installs bundle assets into a given
 directory (e.g. the web directory).

 php app/console assets:install web

 A "bundles" directory will be created inside the target directory, and the
 "Resources/public" directory of each bundle will be copied into it.

 To create a symlink to each bundle instead of copying its assets, use the
 --symlink option:

 php app/console assets:install web --symlink

【讨论】:

  • 我发现了 --symlink。对不起,我忘了提出这个问题..现在我要编辑它。但好像我不能用它。
【解决方案2】:

--symlink 参数是您的解决方案是对的。

假设您使用的是 Windows,您需要做的是从以管理员级别权限运行的命令窗口执行命令。您可以在 Google 上搜索如何为您的操作系统执行此操作,因为在不同版本的 Windows 上有更好的方法,而您没有说明您使用的是什么。

【讨论】:

  • @lcode4food 我正在使用 XP,正如 cheesemacfly 所说,似乎缺少 vista 之前的 Windows 版本 --symlink?
  • 我从来不知道 Windows 支持符号链接。这改变了一切!
【解决方案3】:

解决了!

我的 Windows 版本 (XP) 不支持 --symlink。我找到了一个适用于 Windows 的 Link shell 扩展,可以做到这一点。这是程序和文档,非常好用!

Link Shell Extension

谢谢大家,很有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-05
    • 1970-01-01
    • 1970-01-01
    • 2017-09-04
    相关资源
    最近更新 更多