定制 realtyhub/bootstrap-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

realtyhub/bootstrap-bundle

Composer 安装命令:

composer require realtyhub/bootstrap-bundle

包简介

Symfony2 Bundle with helpful tools relating to Twitter Bootstrap

README 文档

README

Freelance Banner

Bootstrap Bundle

Symfony2 Bundle for Twitter Boostrap

At the moment, this bundle has one purpose. It will allow your allow LESS files in your application, to have access to the variables in Twitter Bootstrap's variables.less

Installation and configuration

Composer.json

{
    ...
    "require": {
        "realtyhub/bootstrap-bundle": "dev-master"
    }
}

AppKernel.php

<?php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\UserBundle\FOSUserBundle(),
    );
}

config.yml

    realtyhub_bootstrap:
        variables_less_path: "/path/to/variables.less"

Basic Usage

Inside a Twig file

    {% stylesheets '@YourBundle/path/to/file.less' filter='bootstrap_variables your_prefered_less_filter' %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}

Warning

You will need to make sure that you are not accidently running the less filter before the bootstrap_variables filter. This usually occurs is you have something like this in your config.yml

assetic:
    filters:
        less:
            node: /usr/bin/node
            node_paths: [/usr/lib/node_modules]
            apply_to: "\.less$"

This filter will run before the "inlined" bootstrap_variables filter and therefore the less will not have access the the variables and will more than likely not complie.

This is why the alternative usage is suggested.

Alternative Usage

config.yml

assetic:
    filters:
        bootstrap_variables:
            resource: 'assetic.xml' #workaround for assetic to accept our filter.
                                            #see https://github.com/symfony/AsseticBundle/issues/50
            apply_to: "\.less$"
        less:
            #Adjust paths to your environment
            node: /usr/bin/node
            node_paths: [/usr/lib/node_modules]
            apply_to: "\.less$"

now inside of Twig file, you wont need to specify the filters and can try something like

    {% stylesheets '@YourBundle/path/to/file.less'  %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}

TODO

  • Better intergration with braincrafted bootstrap bundle. Is it possible to automattically determine the path to variables.less and remove the need for the configuration?

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固