jshanson7/prefix-property

语言: JavaScript

git: https://github.com/jshanson7/prefix-property

供应商前缀任何属性。
Vendor-prefix any property.
README.md (中文)

前缀属性

浏览器中的供应商前缀,不吸引人。

简单用法:

import prefix from 'prefix-property';
// or 
const prefix = window.prefixProperty;

// in chrome:
prefix('fontFeatureSettings');      // => 'WebkitFontFeatureSettings'
prefix.css('fontFeatureSettings');  // => '-webkit-font-feature-settings'

高级用法:

import { js, css, jsPrefix, cssPrefix } from 'prefix-property';

// in chrome:
js('fontFeatureSettings');      // => 'WebkitFontFeatureSettings'
js('font-feature-settings');    // => 'WebkitFontFeatureSettings'
css('fontFeatureSettings');     // => '-webkit-font-feature-settings'
css('font-feature-settings');   // => '-webkit-font-feature-settings'

// browser's prefix:
jsPrefix();    // => 'Webkit'
cssPrefix();   // => '-webkit-'

// non-prefixed properties:
js('color');              // => 'color'
js('background-color');   // => 'backgroundColor'

prefixProperty()的默认输出是JS友好的prop(例如:WebkitTransformOriginX)。

要获得CSS友好的道具,请使用prefixProperty.css()(例如:-webkit-transform-origin-x)。

安装

npm i prefix-property --save

或者将/dist/prefix-property.min.js添加到你的html中。

特约

克隆回购,然后进入它

npm install && npm run build && npm test

建造

npm run build

测试

在此处运行您的浏览器上的测试。

npm test

对于实时重新测试:

npm run test-watch

浏览器:

npm run build && open test/test.html

节点:

npm run test-node

掉毛

npm run lint

执照

WITH

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Prefix Property NPM version Build status

An in-browser vendor prefixer that doesn't suck.

Simple usage:

import prefix from 'prefix-property';
// or 
const prefix = window.prefixProperty;

// in chrome:
prefix('fontFeatureSettings');      // => 'WebkitFontFeatureSettings'
prefix.css('fontFeatureSettings');  // => '-webkit-font-feature-settings'

Advanced usage:

import { js, css, jsPrefix, cssPrefix } from 'prefix-property';

// in chrome:
js('fontFeatureSettings');      // => 'WebkitFontFeatureSettings'
js('font-feature-settings');    // => 'WebkitFontFeatureSettings'
css('fontFeatureSettings');     // => '-webkit-font-feature-settings'
css('font-feature-settings');   // => '-webkit-font-feature-settings'

// browser's prefix:
jsPrefix();    // => 'Webkit'
cssPrefix();   // => '-webkit-'

// non-prefixed properties:
js('color');              // => 'color'
js('background-color');   // => 'backgroundColor'

The default output of prefixProperty() is a JS-friendly prop (ex: WebkitTransformOriginX).

To get a CSS-friendly prop, use prefixProperty.css() (ex: -webkit-transform-origin-x).

Installation

npm i prefix-property --save

or add /dist/prefix-property.min.js to your html.

Contributing

Clone repo, cd into it, then

npm install && npm run build && npm test

Building

npm run build

Testing

Run the tests on your browser here.

npm test

For live retesting:

npm run test-watch

Browser:

npm run build && open test/test.html

Node:

npm run test-node

Linting

npm run lint

License

MIT