在Symfony 2中使用指南针/无礼 [英] Using compass/sass with Symfony 2

查看:52
本文介绍了在Symfony 2中使用指南针/无礼的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找答案,但是没有找到我想要的东西。

I've been googling around for an answer to this but haven't found exactly what I'm looking for.

我将脚趾浸入Symfony框架的水已经使用CodeIgniter几年了。到目前为止,我喜欢捆绑方法,除了我在处理资产(特别是css文件)的处理方法方面遇到一些问题。

I'm dipping my toes in the water of the Symfony framework having been using CodeIgniter for a few years. I like the "bundle" approach so far except that I'm having a few issues getting my head around how to deal with assets, specifically css files.

使用Compass框架,通常将使用编译为一个主样式表的部分来建立目录结构。但是,由于我的Symfony项目已拆分为多个包,因此我希望(可能应该应该)将每个包的css保留在包中,并且在主 web目录中仅包含类似全局模板的内容。
我的问题是这个...

I am used to using the Compass framework and typically will set up a directory structure using partials that compile down to one main stylesheet. However, because my Symfony project is split into bundles I would like (and probably should) keep the css for each bundle within the bundle and only have global template-like stuff in the main "web" directory. My problem is this...

如果我在 web目录中设置了罗盘项目,我该如何包括单个捆绑包中的部分内容?

If I have a compass project setup in my "web" directory, how can I include partials from my individual bundles?

我考虑过为我创建的每个捆绑软件创建单独的指南针项目,但是如何将它们全部组合成一个压缩文件?那是我应该使用Assetic的东西吗?

I thought about having separate compass projects for each bundle that I create but how would I then combine them all into one, compressed file? Is that something I should use Assetic for? Is that frankly organisational overkill?

很高兴收到别人发现类似情况的建议!

Any suggestions from others who have found themselves in a similar situation would be gratefully received!

推荐答案

我最终在主app / Resources文件夹中为我的罗盘项目建立了目录结构。我已经能够创建特定于捆绑包的目录,如果需要的话,然后使用Compass将全部文件编译成一个主要的css文件(也存储在app / Resources / public中。
然后我使用Assetic使用将样式表包含到基本树枝模板中的常规方法将文件发布(或执行任何操作)到我的Web根目录中。

I ended up making a directory structure for my compass project in the main app/Resources folder. I've been able to create "bundle-specific" directories if I need them and then use Compass to compile the whole lot down to one main css file (also stored in app/Resources/public. I then use Assetic to "publish" (or whatever it does) that file into my web root using the normal method of including stylesheets into my base twig templates.

这篇关于在Symfony 2中使用指南针/无礼的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆