我是symfony 2和Assetic的新手。我想使用assetic和Sass作为我的CSS。我使用自定义字体。我在参考资料下的包中创建了"assets/css“文件夹,里面有_base.scss和main.scss。在我的公用文件夹中:
在字体中,我有我的自定义字体。
在我的SCSS中,我检索我的字体和图像,如下所示:
@include font-face("billabongregular", font-files("/bundles/Mybundle/fonts/billabong-webfont.ttf"));
background: $bg_header url("/bundles/Mybundle/images/darkGreyBackground.jpg") fixed no-repeat top center;我有一个在资产之后的路径:安装,我的文件在web/mybundle/fonts和web/mybundle/映像下面
当我做php app/console assetic:dump --env=prod --no-debug时
我在我的网站上:
但我没有字体文件夹和图片文件夹。如果IO在图像中看到源代码,我有这个路径/bundles/Mybundle/images/darkGreyBackground.jpg
为什么我没有所有的文件夹在网上?用/bundles/Mybundle/images/darkGreyBackground.jpg和/bundles/Mybundle/fonts/billabong-webfont.ttf?调用我的图片和字体对吗?
发布于 2013-02-25 20:06:34
这是一种标准的、预期的行为,在调用web/bundles/Mybundle/命令之后,将包的资源的符号链接置于php app/console assetic:dump下。
要使用css中生成的资产路径,可以使用cssrewrite筛选器,甚至更简单,css和images文件夹位于同一个主文件夹中,使用相对路径:
@include font-face("billabongregular", font-files("../fonts/billabong-webfont.ttf"));
background: $bg_header url("../images/darkGreyBackground.jpg") fixed no-repeat top center;编辑
在包中,如果要在运行web命令后在assets:install目录中访问文件,则必须将它们放在Resources/public/目录中,如下所示:creation.html#bundle-directory-structure
发布于 2013-10-19 22:18:02
我也遇到了同样的问题,我只是尝试用下面的方法来解决这个问题。到目前为止似乎还有效。
{% stylesheets
output='assets/fonts/glyphicons-halflings-regular.ttf'
'bundles/bootstrap/fonts/glyphicons-halflings-regular.ttf'
%}{% endstylesheets %}注意,遗漏了任何输出,这意味着模板上没有显示任何内容。当我运行assetic:dump时,文件被复制到所需的位置,css也按预期的方式包含工作。
https://stackoverflow.com/questions/15073559
复制相似问题