Skip to content

Commit 67eba47

Browse files
committed
Re-enable prefixing for all browser versions
The v3 update of inline-style-prefixer changed the set of browsers that it would generate prefixes for by default. To prevent this from being a breaking change for Aphrodite users, we are generating our own prefixer data in a way that supports all versions of all browsers. The guide for this can be found at: https://github.com/rofrischmann/inline-style-prefixer/blob/master/docs/guides/CustomPrefixAll.md It would be nice to eventually allow consumers of Aphrodite to customize the browser support matrix, but in the meantime, this will do.
1 parent 2b639f6 commit 67eba47

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
"coverage": "nyc --check-coverage --lines 100 --branches 100 npm run tests",
1616
"tests": "mocha --compilers js:babel/register tests",
1717
"tests:watch": "mocha --watch --compilers js:babel/register tests",
18-
"prebuild": "rimraf dist lib",
18+
"prebuild": "rimraf dist/* lib/*",
1919
"build": "npm-run-all --parallel build:*",
2020
"watch:build": "npm-run-all --parallel watch:build:*",
21+
"build:prefixes": "tools/generate_prefixer_data.js",
2122
"build:main": "babel -d lib/ src",
2223
"watch:build:main": "npm run build:main -- --watch",
2324
"build:umd": "webpack --output-library-target umd --output-library aphrodite --output-filename aphrodite.umd.js --devtool source-map",
@@ -43,13 +44,15 @@
4344
"babel": "^5.8.23",
4445
"babel-core": "^5.8.25",
4546
"babel-loader": "^5.3.2",
47+
"caniuse-api": "^1.5.3",
4648
"chai": "^3.3.0",
4749
"es6-shim": "^0.35.3",
4850
"eslint": "^3.7.1",
4951
"eslint-config-standard-react": "^4.2.0",
5052
"eslint-plugin-react": "^6.3.0",
5153
"flow-bin": "^0.34.0",
5254
"jsdom": "^6.5.1",
55+
"mkdirp": "^0.5.1",
5356
"mocha": "^2.3.3",
5457
"npm-run-all": "^1.7.0",
5558
"nyc": "^6.4.4",

src/generate.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/* @flow */
2-
import prefixAll from 'inline-style-prefixer/static';
2+
import createPrefixer from 'inline-style-prefixer/static/createPrefixer';
3+
import staticData from '../lib/staticPrefixData';
34

45
import OrderedElements from './ordered-elements';
56
import {
67
objectToPairs, kebabifyStyleName, recursiveMerge, stringifyValue,
78
importantify, flatten
89
} from './util';
910

11+
const prefixAll = createPrefixer(staticData);
12+
1013
/* ::
1114
import type { SheetDefinition } from './index.js';
1215
type StringHandlers = { [id:string]: Function };

tests/generate_test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,13 @@ ${formatStyles(actual)}
191191
justifyContent: 'center',
192192
}], '.foo{' +
193193
'-webkit-box-pack:center !important;' +
194+
'-ms-flex-pack:center !important;' +
194195
'-webkit-box-align:center !important;' +
195-
'display:-ms-flexbox !important;' +
196-
'display:-webkit-flex !important;' +
196+
'-ms-flex-align:center !important;' +
197197
'display:flex !important;' +
198198
'display:-webkit-box !important;' +
199+
'display:-ms-flexbox !important;' +
200+
'display:-webkit-flex !important;' +
199201
'display:-moz-box !important;' +
200202
'-webkit-transition:all 0s !important;' +
201203
'-moz-transition:all 0s !important;' +

tools/generate_prefixer_data.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
const generateData = require("inline-style-prefixer/generator");
3+
const mkdirp = require("mkdirp");
4+
5+
// We want all of the browser prefixes available, so set the browser version
6+
// to support to 0.
7+
const browserList = {
8+
chrome: 0,
9+
android: 0,
10+
firefox: 0,
11+
ios_saf: 0,
12+
safari: 0,
13+
ie: 0,
14+
ie_mob: 0,
15+
edge: 0,
16+
opera: 0,
17+
op_mini: 0,
18+
and_uc: 0,
19+
and_chr: 0,
20+
};
21+
22+
mkdirp(`${__dirname}/../lib`);
23+
generateData(browserList, {
24+
staticPath: `${__dirname}/../lib/staticPrefixData.js`,
25+
compatibility: true,
26+
});

0 commit comments

Comments
 (0)