chaplean/outdated-browser-bundle

过时浏览器组件

安装: 1

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 3

语言:HTML

类型:symfony-bundle

v4.0.1 2019-07-10 07:33 UTC

README

1. 在 AppKernel 中添加我

app/AppKernel.php

...
    /**
     * @return array
     */
    public function registerBundles()
    {
        return array(
            ...
            new Chaplean\Bundle\OutdatedBrowserBundle\ChapleanOutdatedBrowserBundle(),
        );
    }
...

2. 定义配置(可选)

app/config/config.yml

# default option
chaplean_outdated_browser:
    background_color: '#f25648'
    color: '#ffffff'
    lower_than: 'transform'
    template: 'ChapleanOutdatedBrowserBundle:Template:outdated.html.twig'

lower_than 可以取

  • "IE11","borderImage"
  • "IE10", "transform"(默认属性)
  • "IE9", "boxShadow"
  • "IE8", "borderSpacing"

3. 更新 assetic

在 assetic 配置中添加此组件

assetic:
    bundles: ['ChapleanOutdatedBrowserBundle']

4. 添加路由

在全局路由中包含路由

app/config/routing.yml

chaplean_outdated_browser_bundle:
    resource: "@ChapleanOutdatedBrowserBundle/Resources/config/routing.yml"
    prefix:   /

5. 在布局中添加脚本

在布局 html 中简单添加我

未压缩版本

<script type="text/javascript" src="{{ path('chaplean-outdated-browser.js') }}"></script>

压缩版本

<script type="text/javascript" src="{{ path('chaplean-outdated-browser.min.js') }}"></script>