agoat/contao-autoprefixer

Contao 4 自动添加浏览器前缀插件

安装次数: 445

依赖者: 0

建议者: 0

安全性: 0

星标: 3

关注者: 2

分支: 0

开放问题: 0

语言:JavaScript

类型:contao-bundle

1.4.0 2021-01-20 12:05 UTC

This package is auto-updated.

Last update: 2024-09-23 00:56:32 UTC


README

Version License Downloads

关于

无需担心供应商前缀。只需编写纯净的(S)CSS。此插件会根据您的设置,使用来自Can I Use的值自动添加浏览器前缀。

编写不带供应商前缀的CSS规则

:fullscreen a {
    display: flex
}

Autoprefixer将根据当前浏览器普及率和属性支持情况使用数据,为您应用前缀。您可以尝试Autoprefixer的交互式演示

:-webkit-full-screen a {
    display: -webkit-box;
    display: flex
}
:-moz-full-screen a {
    display: flex
}
:-ms-fullscreen a {
    display: -ms-flexbox;
    display: flex
}
:fullscreen a {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex
}

Autoprefixer使用Browserslist,因此您可以通过查询如last 2 versions> 5%来指定项目中要针对的浏览器。

有关查询、浏览器名称、配置格式和默认值,请参阅Browserslist文档

或访问Autoprefixer项目页面获取更多信息。

要求

此插件使用的autoprefixer工具是用JavaScript编写的,并通过node调用。因此,服务器上必须安装Node.js

访问https://node.org.cn查看如何安装Node.js。

安装

Contao管理器

搜索包并安装

agoat/contao-autoprefixer

管理版

添加包

# Using the composer
composer require agoat/contao-autoprefixer

注册和配置将由管理插件自动完成。

标准版

添加包

# Using the composer
composer require agoat/contao-autoprefixer

在AppKernel中注册包

# app/AppKernel.php
class AppKernel
{
    // ...
    public function registerBundles()
    {
        $bundles = [
            // ...
            // after Contao\CoreBundle\ContaoCoreBundle
            new Agoat\AutoPrefixerBundle\AgoatAutoPrefixerBundle(),
        ];
    }
}