symfony composer update twbs 文件在哪里?
symfony composer update twbs where are the files?
我添加了
"twbs/bootstrap" : "3.3.5",
"components/jquery" : "2.1.4"
到我的 composer.json 文件。
我 运行 composer:update 没问题。
但是现在是时候使用 assetic 创建文件,composer 使用符号链接来安装组件和 twbs 文件夹了。
在 ::base.html.twig 我会写类似下面的东西...
{% block stylesheets %}
{% stylesheets filter = 'cssrewrite'
'%kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/boostrap.css'
'%kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/bootsrtap-theme.css'
'@AppBundle/Resources/public/css/custom.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
但是由于作曲家安装的符号链接,重写路径不正确...
我的问题:这些文件实际去了哪里?
或者是否有另一种语法来获取 twig 中的文件?
我想我需要这个...'%kerner.root_dir%/path/to/the/files'
你通过 composer 安装的所有东西 json 都会进入 vendor 文件夹(在 web 文件夹之外)
如果你在linux或osxOS,你应该检查web/bundles/文件夹,如果你在windows,我不'认为您会有符号链接(所以每次您进行作曲家更新时它可能都是硬拷贝)。反正。我认为你永远不应该在树枝上使用 %kernel.root_dir% 。
在我的例子中,我使用的其中一个包在 web/bundles 下符号链接到真实文件夹。例如 guzzle :
lrwxrwxrwx 1 odin odin 88 ago 9 13:47 guzzle -> ../../vendor/eightpoints/guzzle-bundle/EightPoints/Bundle/GuzzleBundle/Resources/public/
所以您应该使用的路径可能是:
bundles/twbs/bootstrap/css/boostrap.css
bundles/twbs/bootstrap/css/boostrap-theme.css
bundles/yourbundle/css/custom.css
而不是使用应用程序的 public 文件夹,至少在文档中建议在 web 中添加 css、js 和 img 文件夹(如果您在多个包中使用它们)
我认为您只需要在终端中执行 php app/console assetic:dump
操作,将所需的资源转储到您的 Web 文件夹中,您可以在其中公开访问这些资源,以便在您的代码中引用。
我添加了
"twbs/bootstrap" : "3.3.5",
"components/jquery" : "2.1.4"
到我的 composer.json 文件。
我 运行 composer:update 没问题。
但是现在是时候使用 assetic 创建文件,composer 使用符号链接来安装组件和 twbs 文件夹了。
在 ::base.html.twig 我会写类似下面的东西...
{% block stylesheets %}
{% stylesheets filter = 'cssrewrite'
'%kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/boostrap.css'
'%kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/bootsrtap-theme.css'
'@AppBundle/Resources/public/css/custom.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
但是由于作曲家安装的符号链接,重写路径不正确...
我的问题:这些文件实际去了哪里? 或者是否有另一种语法来获取 twig 中的文件?
我想我需要这个...'%kerner.root_dir%/path/to/the/files'
你通过 composer 安装的所有东西 json 都会进入 vendor 文件夹(在 web 文件夹之外)
如果你在linux或osxOS,你应该检查web/bundles/文件夹,如果你在windows,我不'认为您会有符号链接(所以每次您进行作曲家更新时它可能都是硬拷贝)。反正。我认为你永远不应该在树枝上使用 %kernel.root_dir% 。 在我的例子中,我使用的其中一个包在 web/bundles 下符号链接到真实文件夹。例如 guzzle :
lrwxrwxrwx 1 odin odin 88 ago 9 13:47 guzzle -> ../../vendor/eightpoints/guzzle-bundle/EightPoints/Bundle/GuzzleBundle/Resources/public/
所以您应该使用的路径可能是:
bundles/twbs/bootstrap/css/boostrap.css
bundles/twbs/bootstrap/css/boostrap-theme.css
bundles/yourbundle/css/custom.css
而不是使用应用程序的 public 文件夹,至少在文档中建议在 web 中添加 css、js 和 img 文件夹(如果您在多个包中使用它们)
我认为您只需要在终端中执行 php app/console assetic:dump
操作,将所需的资源转储到您的 Web 文件夹中,您可以在其中公开访问这些资源,以便在您的代码中引用。