Skip to content

Commit

Permalink
remove dynamic version
Browse files Browse the repository at this point in the history
  • Loading branch information
rofrischmann committed Sep 5, 2018
1 parent bee1303 commit 682c119
Show file tree
Hide file tree
Showing 104 changed files with 1,451 additions and 11,351 deletions.
20 changes: 14 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{
"presets": [
"es2015",
[
"es2015",
{
"modules": false
}
],
"stage-0",
"react"
],
"plugins": [
"add-module-exports",
"transform-class-properties"
]
}
"env": {
"commonjs": {
"plugins": [
"transform-es2015-modules-commonjs"
]
}
}
}
12 changes: 0 additions & 12 deletions .eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
.*/node_modules/chalk/*.*

[version]
^0.38.0
^0.80.0
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ Thumbs.db
*.sw?
*.vi

static/
dynamic/
utils/
generator/
node_modules/
npm-debug.log
coverage
**/coverage
_book
.vscode
lib
es
2 changes: 0 additions & 2 deletions .istanbul.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "5"
- "8"
script:
- npm run check
addons:
Expand Down
58 changes: 0 additions & 58 deletions .vscode/settings.json

This file was deleted.

6 changes: 6 additions & 0 deletions Changelog.md → CHANGELOGO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 5.0
We entirely removed the dynamic version of the prefixer due to constant issues with browser detection and the almost impossible need to keep all the versions updated and in sync.
There are no other changes except the import paths for this version.

Improvements, additions and bug fixes will be build on top of the new major version shortly.

## 4.0

### 4.0.2
Expand Down
85 changes: 10 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
# Autoprefixer for Style Objects
# inline-style-prefixer

**inline-style-prefixer** adds required **vendor prefixes** to your style object. It only adds prefixes if they're actually required by evaluating the browser's `userAgent` against data from [caniuse.com](http://caniuse.com/).
<br>
A small, simple and fast vendor prefixer from JavaScript style object.

Alternatively it ships a static version that adds all available vendor prefixes.

[![Build Status](https://travis-ci.org/rofrischmann/inline-style-prefixer.svg)](https://travis-ci.org/rofrischmann/inline-style-prefixer)
[![Test Coverage](https://codeclimate.com/github/rofrischmann/inline-style-prefixer/badges/coverage.svg)](https://codeclimate.com/github/rofrischmann/inline-style-prefixer/coverage)
[![npm downloads](https://img.shields.io/npm/dm/inline-style-prefixer.svg)](https://img.shields.io/npm/dm/inline-style-prefixer.svg)
![Dependencies](https://david-dm.org/rofrischmann/inline-style-prefixer.svg)
<img alt="TravisCI" src="https://travis-ci.org/rofrischmann/inline-style-prefixer.svg?branch=master"> <a href="https://codeclimate.com/github/rofrischmann/inline-style-prefixer/coverage"><img alt="Test Coverage" src="https://codeclimate.com/github/rofrischmann/inline-style-prefixer/badges/coverage.svg"></a> <img alt="npm downloads" src="https://img.shields.io/npm/dm/inline-style-prefixer.svg"> <img alt="gzipped size" src="https://img.shields.io/bundlephobia/minzip/inline-style-prefixer.svg?colorB=4c1&label=gzipped%20size"> <img alt="npm version" src="https://badge.fury.io/js/inline-style-prefixer.svg">

## Support Us
Support Robin Frischmann's work on [Fela](https://github.com/rofrischmann/fela) and its ecosystem (inline-style-prefixer) directly via [**Patreon**](https://www.patreon.com/rofrischmann).

Or support us on [**Open Collective**](https://opencollective.com/fela) to fund community work. This also includes inline-style-prefixer as well.<br>
Thank you to all our backers!

<a href="https://opencollective.com/fela/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/0/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/1/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/2/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/3/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/4/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/5/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/6/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/7/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/8/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/fela/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/fela/backer/9/avatar.svg?requireActive=false"></a>

## Installation
```sh
yarn add inline-style-prefixer
```
If you're still using npm, you may run `npm i --save inline-style-prefixer`.
We also provide [UMD](https://github.com/umdjs/umd) builds for each package in the `dist` folder. You can easily use them via [unpkg](https://unpkg.com/).
```HTML
<!-- Unminified versions -->
<script src="https://unpkg.com/inline-style-prefixer@3.0.1/dist/inline-style-prefixer.js"></script>
<script src="https://unpkg.com/inline-style-prefixer@3.0.1/dist/inline-style-prefix-all.js"></script>
<!-- Minified versions -->
<script src="https://unpkg.com/inline-style-prefixer@3.0.1/dist/inline-style-prefixer.min.js"></script>
<script src="https://unpkg.com/inline-style-prefixer@3.0.1/dist/inline-style-prefix-all.min.js"></script>
```

## Browser Support
It supports all major browsers with the following versions. For other, unsupported browses, we automatically use a fallback.
Expand All @@ -63,45 +34,10 @@ It will **only** add prefixes if a property still needs them in one of the above
Don't worry - we got you covered. Check [this guide](https://github.com/rofrischmann/inline-style-prefixer/blob/master/docs/guides/CustomPrefixer.md).


## Dynamic vs. Static
Before using the prefixer, you have to decide which one you want to use. We ship two different versions - a dynamic and a static version.

The **dynamic prefixer** evaluates the `userAgent` to identify the browser environment. Using this technique, we are able to only add the bare minimum of prefixes. Browser detection is quite accurate (~90% correctness), but yet also expensive which is why the package is almost 3 times as big as the static version.

> It uses the static prefixer as a fallback.
![Gzipped Size](https://img.shields.io/badge/gzipped-8.50kb-brightgreen.svg)

```javascript
import Prefixer from 'inline-style-prefixer'

const style = {
transition: '200ms all linear',
userSelect: 'none',
boxSizing: 'border-box',
display: 'flex',
color: 'blue'
}

const prefixer = new Prefixer()
const prefixedStyle = prefixer.prefix(style)

// prefixedStyle === output
const output = {
transition: '200ms all linear',
WebkitUserSelect: 'none',
boxSizing: 'border-box',
display: '-webkit-flex',
color: 'blue'
}
```

The **static prefixer**, on the other hand, adds all required prefixes according the above mentioned browser versions. Removing the browser detection makes it both smaller and fast, but also drastically increases the output.

![Gzipped Size](https://img.shields.io/badge/gzipped-2.70kb-brightgreen.svg)
## Usage

```javascript
import prefixAll from 'inline-style-prefixer/static'
import prefix from 'inline-style-prefixer'

const style = {
transition: '200ms all linear',
Expand All @@ -110,10 +46,9 @@ const style = {
color: 'blue'
}

const prefixedStyle = prefixAll(style)
const output = prefix(style)

// prefixedStyle === output
const output = {
output === {
WebkitTransition: '200ms all linear',
transition: '200ms all linear',
MozBoxSizing: 'border-box',
Expand All @@ -130,12 +65,12 @@ You can use TypeScript definition from [DefinitelyTyped](https://github.com/Defi
npm install --save @types/inline-style-prefixer
```

Then import in your code:
Then import in your code

```typescript
import prefixAll = require('inline-style-prefixer/static');
import prefix = require('inline-style-prefixer');

const prefixedStyle = prefixAll({
const prefixedStyle = prefix({
transition: '200ms all linear',
boxSizing: 'border-box',
display: 'flex',
Expand Down
20 changes: 7 additions & 13 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

* [Read Me](README.md)
* [1. Usage Guides](docs/UsageGuides.md)
* [1.1. Client / Server Prefixing](docs/guides/ClientServerPrefixing.md)
* [1.2. Resolving Array Values](docs/guides/ResolvingArrays.md)
* [1.3. Creating your own Prefixer](docs/guides/CustomPrefixer.md)
* [1.4. Creating your own prefixAll](docs/guides/CustomPrefixAll.md)
* [1.2. Resolving Array values](docs/guides/ResolvingArrays.md)
* [1.3. Creating your own prefixer](docs/guides/CustomPrefixer.md)
* [2. Data Reference](docs/DataReference.md)
* [2.1. Supported Properties](docs/data/SupportedProperties.md)
* [2.2. Special Plugins](docs/data/SpecialPlugins.md)
* [3. API Reference](docs/API.md)
* 3.1. inline-style-prefixer
* [3.1.1. Prefixer](docs/api/inline-style-prefixer/Prefixer.md)
* [3.1.2. createPrefixer](docs/api/inline-style-prefixer/createPrefixer.md)
* 3.2. inline-style-prefixer/static
* [3.2.1. prefixAll](docs/api/inline-style-prefixer-static/prefixAll.md)
* [3.2.2. createPrefixer](docs/api/inline-style-prefixer-static/createPrefixer.md)
* 3.3. inline-style-prefixer/generator
* [3.3.1. generateData](docs/api/inline-style-prefixer-generator/generateData.md)
* [4. FAQ](docs/FAQ.md)
* [3.1. prefix](docs/api/prefix.md)
* [3.2. createPrefixer](docs/api/createPrefixer.md)
* 3.3. generator
* [3.3.1. generateData](docs/api/generator/generateData.md)
* [5. CHANGELOG](CHANGELOG.md)
71 changes: 0 additions & 71 deletions buildPackage.js

This file was deleted.

13 changes: 4 additions & 9 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# API Reference

### inline-style-prefixer
* [Prefixer](api/inline-style-prefixer/Prefixer.md)
* [createPrefixer](api/inline-style-prefixer/createPrefixer.md)
* [prefix](api/prefix.md)
* [createPrefixer](api/createPrefixer.md)

### inline-style-prefixer/static
* [prefixAll](api/inline-style-prefixer-static/prefixAll.md)
* [createPrefixer](api/inline-style-prefixer-static/createPrefixer.md)

### inline-style-prefixer/generator
* [generateData](api/inline-style-prefixer-generator/generateData.md)
### Generator
* [generateData](api/generator/generateData.md)
Loading

0 comments on commit 682c119

Please sign in to comment.