Skip to content

Download w3c data #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ List of standard and browser specific CSS properties.

## Source

1. Standard properties (only 'CR', 'WD', 'FPWD', 'LC', 'REC' statuses): http://www.w3.org/Style/CSS/all-properties.en.json
1. Standard properties (only 'REC', 'CR', 'LC', 'WD', 'FPWD', 'ED' statuses): http://www.w3.org/Style/CSS/all-properties.en.json
2. Browser supported properties from `window.getComputedStyle` / `document.body.style`

### Windows
Expand Down
81 changes: 75 additions & 6 deletions data/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"-webkit-background-color",
"-webkit-background-composite",
"background-image",
"background-image-transform",
"-webkit-background-image",
"-moz-background-inline-policy",
"background-origin",
Expand All @@ -96,6 +97,11 @@
"-moz-binding",
"-ms-block-progression",
"block-size",
"block-step",
"block-step-align",
"block-step-insert",
"block-step-round",
"block-step-size",
"bookmark-label",
"bookmark-level",
"bookmark-state",
Expand All @@ -108,6 +114,8 @@
"-webkit-border-before-style",
"-webkit-border-before",
"-webkit-border-before-width",
"border-block",
"border-block-color",
"border-block-end",
"border-block-end-color",
"border-block-end-style",
Expand All @@ -116,6 +124,8 @@
"border-block-start-color",
"border-block-start-style",
"border-block-start-width",
"border-block-style",
"border-block-width",
"border-bottom",
"border-bottom-color",
"-moz-border-bottom-colors",
Expand Down Expand Up @@ -149,9 +159,12 @@
"-webkit-border-image-slice",
"border-image-source",
"-webkit-border-image-source",
"border-image-transform",
"-webkit-border-image",
"border-image-width",
"-webkit-border-image-width",
"border-inline",
"border-inline-color",
"border-inline-end",
"border-inline-end-color",
"border-inline-end-style",
Expand All @@ -160,6 +173,8 @@
"border-inline-start-color",
"border-inline-start-style",
"border-inline-start-width",
"border-inline-style",
"border-inline-width",
"border-left",
"border-left-color",
"-moz-border-left-colors",
Expand Down Expand Up @@ -223,7 +238,6 @@
"-moz-box-sizing",
"-webkit-box-sizing",
"box-snap",
"box-suppress",
"break-after",
"break-before",
"break-inside",
Expand All @@ -233,6 +247,7 @@
"caret-animation",
"caret-color",
"caret-shape",
"chains",
"clear",
"clip",
"clip-path",
Expand Down Expand Up @@ -292,6 +307,7 @@
"-ms-content-zoom-snap-points",
"-ms-content-zoom-snap-type",
"-ms-content-zooming",
"continue",
"counter-increment",
"counter-reset",
"counter-set",
Expand All @@ -313,8 +329,15 @@
"empty-cells",
"enable-background",
"fill",
"fill-break",
"fill-color",
"fill-image",
"fill-opacity",
"fill-origin",
"fill-position",
"fill-repeat",
"fill-rule",
"fill-size",
"filter",
"-ms-filter",
"-webkit-filter",
Expand Down Expand Up @@ -356,6 +379,7 @@
"float-reference",
"flood-color",
"flood-opacity",
"flow",
"flow-from",
"-ms-flow-from",
"-webkit-flow-from",
Expand All @@ -373,6 +397,11 @@
"-webkit-font-kerning",
"font-language-override",
"-moz-font-language-override",
"font-max-size",
"font-min-size",
"font-optical-sizing",
"font-palette",
"font-presentation",
"font-size",
"font-size-adjust",
"-webkit-font-size-delta",
Expand Down Expand Up @@ -466,6 +495,13 @@
"input-format",
"-wap-input-format",
"-wap-input-required",
"inset",
"inset-block",
"inset-block-end",
"inset-block-start",
"inset-inline",
"inset-inline-end",
"inset-inline-start",
"-ms-interpolation-mode",
"isolation",
"justify-content",
Expand Down Expand Up @@ -510,13 +546,15 @@
"-webkit-margin-after",
"-webkit-margin-before-collapse",
"-webkit-margin-before",
"margin-block",
"margin-block-end",
"margin-block-start",
"margin-bottom",
"-webkit-margin-bottom-collapse",
"-webkit-margin-collapse",
"-moz-margin-end",
"-webkit-margin-end",
"margin-inline",
"margin-inline-end",
"margin-inline-start",
"margin-left",
Expand Down Expand Up @@ -670,11 +708,13 @@
"padding",
"-webkit-padding-after",
"-webkit-padding-before",
"padding-block",
"padding-block-end",
"padding-block-start",
"padding-bottom",
"-moz-padding-end",
"-webkit-padding-end",
"padding-inline",
"padding-inline-end",
"padding-inline-start",
"padding-left",
Expand Down Expand Up @@ -709,10 +749,6 @@
"place-self",
"play-during",
"pointer-events",
"polar-anchor",
"polar-angle",
"polar-distance",
"polar-origin",
"position",
"-webkit-print-color-adjust",
"quotes",
Expand Down Expand Up @@ -749,20 +785,41 @@
"-ms-scroll-limit-x-min",
"-ms-scroll-limit-y-max",
"-ms-scroll-limit-y-min",
"scroll-padding",
"scroll-padding-block",
"scroll-padding-block-end",
"scroll-padding-block-start",
"scroll-padding-bottom",
"scroll-padding-inline",
"scroll-padding-inline-end",
"scroll-padding-inline-start",
"scroll-padding-left",
"scroll-padding-right",
"scroll-padding-top",
"-ms-scroll-rails",
"scroll-snap-align",
"scroll-snap-coordinate",
"-webkit-scroll-snap-coordinate",
"scroll-snap-destination",
"-webkit-scroll-snap-destination",
"scroll-snap-margin",
"scroll-snap-padding",
"scroll-snap-margin-block",
"scroll-snap-margin-block-end",
"scroll-snap-margin-block-start",
"scroll-snap-margin-bottom",
"scroll-snap-margin-inline",
"scroll-snap-margin-inline-end",
"scroll-snap-margin-inline-start",
"scroll-snap-margin-left",
"scroll-snap-margin-right",
"scroll-snap-margin-top",
"scroll-snap-points-x",
"-ms-scroll-snap-points-x",
"-webkit-scroll-snap-points-x",
"scroll-snap-points-y",
"-ms-scroll-snap-points-y",
"-webkit-scroll-snap-points-y",
"scroll-snap-stop",
"scroll-snap-type",
"-ms-scroll-snap-type",
"-webkit-scroll-snap-type",
Expand All @@ -776,6 +833,7 @@
"scrollbar-dark-shadow-color",
"scrollbar-darkshadow-color",
"scrollbar-face-color",
"scrollbar-gutter",
"scrollbar-highlight-color",
"scrollbar-shadow-color",
"scrollbar-track-color",
Expand Down Expand Up @@ -808,15 +866,25 @@
"stress",
"string-set",
"stroke",
"stroke-align",
"stroke-alignment",
"stroke-break",
"stroke-color",
"stroke-dash-corner",
"stroke-dash-justify",
"stroke-dashadjust",
"stroke-dasharray",
"stroke-dashcorner",
"stroke-dashoffset",
"stroke-image",
"stroke-linecap",
"stroke-linejoin",
"stroke-miterlimit",
"stroke-opacity",
"stroke-origin",
"stroke-position",
"stroke-repeat",
"stroke-size",
"stroke-width",
"-webkit-svg-shadow",
"tab-size",
Expand All @@ -826,6 +894,7 @@
"table-layout",
"-webkit-tap-highlight-color",
"text-align",
"text-align-all",
"text-align-last",
"-moz-text-align-last",
"text-anchor",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"main": "index.js",
"scripts": {
"bump": "npm version patch && npm publish && git push && git push --tags",
"generate": "node scripts/generate.js",
"download-w3c-data": "node scripts/download-w3c-data",
"generate": "node scripts/generate",
"lint": "eslint index.js scripts/*.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -28,6 +29,7 @@
},
"homepage": "https://github.com/betit/known-css-properties#readme",
"devDependencies": {
"axios": "^0.16.2",
"eslint": "^3.19.0",
"globby": "^6.1.0",
"lodash.sortby": "^4.7.0",
Expand Down
27 changes: 27 additions & 0 deletions scripts/download-w3c-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { writeFile } = require('fs');
const { resolve } = require('path');
const uniq = require('lodash.uniq');
const axios = require('axios');

const outputFile = resolve(__dirname, '../source/w3c.json');
const w3URL = 'https://www.w3.org/Style/CSS/all-properties.en.json';
const validStatuses = ['REC', 'CR', 'LC', 'WD', 'FPWD', 'ED'];

const isEntryValid = ({property, status}) =>
!property.startsWith('--') && validStatuses.includes(status)

const saveData = (properties) =>
new Promise((resolve, reject) => {
writeFile(
outputFile,
JSON.stringify({ properties }, null, 2),
(err, res) => err ? reject(err) : resolve(res)
);
});

axios.get(w3URL)
.then(res => res.data.filter(isEntryValid))
.then(properties => properties.map(({property}) => property))
.then(properties => uniq(properties))
.then(saveData)
.catch(err => console.error(err));
Loading