在Symfony 2项目中安装Bootstrap主题 [英] Installing Bootstrap theme in Symfony 2 project

查看:251
本文介绍了在Symfony 2项目中安装Bootstrap主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在我的SF2项目中安装这个主题,我注意到有4个文件页面的顶部下载,即:

I am looking at installing this theme in my SF2 project, and I note that there are 4 files at the top of the page to download, namely:


  • bootstrap.min.css

  • bootstrap。 css

  • variables.less

  • bootswatch.less

  • bootstrap.min.css
  • bootstrap.css
  • variables.less
  • bootswatch.less

我有less.php( oyejorge / less.php )解析器成功安装与引导本身,我有Assetic设置压缩所有我的CSS在一起,并输出到网页:

I have the less.php (oyejorge/less.php) parser successfully installed along with bootstrap itself, and I have Assetic setup compressing all my CSS together and outputting this to the page:

< link href =/ app_dev.php / css / 425e28c.csstype =text / css = stylesheet>

但是,我想在上面的链接中安装超级英雄主题,但我找不到任何教程如何做到这一点?是否只是覆盖 variables.less 并导入 bootswatch.less

However, I would like to install the Superhero theme in the link above but I can't find any tutorials on how to do this? Is it just a case of overwriting variables.less and importing bootswatch.less?

推荐答案

同时阅读 https://github.com/thomaspark/bootswatch

如果您想要使用主题(没有自定义),您只需要包含bootstrap.min.css或bootstrap.css到您的HTML中:

If you want to use the theme as is (without customization) you only should include the bootstrap.min.css OR bootstrap.css into your HTML:

<link href="/bootstrap.min.css" type="text/css" rel="stylesheet">

或者,您可以编译自己的主题版本:

Alternatively you can compile your own version of the theme:


  1. http://getbootstrap.com下载Bootstrap的源文件/ get-started /#下载

  2. 在源文件中,使用从bootswatch下载的/ variables.less文件替换less / variables.less文件

  3. 将bootswatch.less复制到引导源文件的less目录

  4. 然后,打开less / bootstrap.less并在此文件末尾添加以下代码行: @importbootswatch

  5. 编译修改的引导,如下所述:执行assetic转储时出错(解析错误:失败在&:extend(.clearfix all) )

  1. Download Bootstrap's source files at http://getbootstrap.com/getting-started/#download
  2. In the source files replace the less/variables.less file with that download from bootswatch
  3. copy the bootswatch.less into the less directory of the bootstrap sources files
  4. Than, open the less/bootstrap.less and add the following line of code at the end of this file: @import "bootswatch"
  5. compile the modified bootstrap as described at: Error while executing assetic dump (parse error: failed at `&:extend(.clearfix all);`)

同时请注意,Bootstrap会在其构建过程中添加供应商前缀的autoprefixer。自v3.2.0起,不推荐使用less / mixins / vendor-prefixes.less中的供应商前缀混合。因此,您应该添加 https://packagist.org/packages/bit3/assetic-autoprefixer 对你的assetic配置太。

Also notice that Bootstrap adds the autoprefixer for vendor prefixes into their build process. The vendor prefix mixins in less/mixins/vendor-prefixes.less are deprecated as of v3.2.0. So you should add https://packagist.org/packages/bit3/assetic-autoprefixer to your assetic configuration too.

这篇关于在Symfony 2项目中安装Bootstrap主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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