├── .gitignore ├── README.md ├── img └── tweet.png ├── package.json ├── src ├── getAllCSSProperties.ts └── index.ts ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,macos 3 | # Edit at https://www.gitignore.io/?templates=node,macos 4 | 5 | ### macOS ### 6 | # General 7 | .DS_Store 8 | .AppleDouble 9 | .LSOverride 10 | 11 | # Icon must end with two \r 12 | Icon 13 | 14 | # Thumbnails 15 | ._* 16 | 17 | # Files that might appear in the root of a volume 18 | .DocumentRevisions-V100 19 | .fseventsd 20 | .Spotlight-V100 21 | .TemporaryItems 22 | .Trashes 23 | .VolumeIcon.icns 24 | .com.apple.timemachine.donotpresent 25 | 26 | # Directories potentially created on remote AFP share 27 | .AppleDB 28 | .AppleDesktop 29 | Network Trash Folder 30 | Temporary Items 31 | .apdisk 32 | 33 | ### Node ### 34 | # Logs 35 | logs 36 | *.log 37 | npm-debug.log* 38 | yarn-debug.log* 39 | yarn-error.log* 40 | lerna-debug.log* 41 | 42 | # Diagnostic reports (https://nodejs.org/api/report.html) 43 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 44 | 45 | # Runtime data 46 | pids 47 | *.pid 48 | *.seed 49 | *.pid.lock 50 | 51 | # Directory for instrumented libs generated by jscoverage/JSCover 52 | lib-cov 53 | 54 | # Coverage directory used by tools like istanbul 55 | coverage 56 | *.lcov 57 | 58 | # nyc test coverage 59 | .nyc_output 60 | 61 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 62 | .grunt 63 | 64 | # Bower dependency directory (https://bower.io/) 65 | bower_components 66 | 67 | # node-waf configuration 68 | .lock-wscript 69 | 70 | # Compiled binary addons (https://nodejs.org/api/addons.html) 71 | build/Release 72 | 73 | # Dependency directories 74 | node_modules/ 75 | jspm_packages/ 76 | 77 | # TypeScript v1 declaration files 78 | typings/ 79 | 80 | # TypeScript cache 81 | *.tsbuildinfo 82 | 83 | # Optional npm cache directory 84 | .npm 85 | 86 | # Optional eslint cache 87 | .eslintcache 88 | 89 | # Optional REPL history 90 | .node_repl_history 91 | 92 | # Output of 'npm pack' 93 | *.tgz 94 | 95 | # Yarn Integrity file 96 | .yarn-integrity 97 | 98 | # dotenv environment variables file 99 | .env 100 | .env.test 101 | 102 | # parcel-bundler cache (https://parceljs.org/) 103 | .cache 104 | 105 | # next.js build output 106 | .next 107 | 108 | # nuxt.js build output 109 | .nuxt 110 | 111 | # rollup.js default build output 112 | dist/ 113 | 114 | # Uncomment the public line if your project uses Gatsby 115 | # https://nextjs.org/blog/next-9-1#public-directory-support 116 | # https://create-react-app.dev/docs/using-the-public-folder/#docsNav 117 | # public 118 | 119 | # Storybook build outputs 120 | .out 121 | .storybook-out 122 | 123 | # vuepress build output 124 | .vuepress/dist 125 | 126 | # Serverless directories 127 | .serverless/ 128 | 129 | # FuseBox cache 130 | .fusebox/ 131 | 132 | # DynamoDB Local files 133 | .dynamodb/ 134 | 135 | # Temporary folders 136 | tmp/ 137 | temp/ 138 | 139 | # End of https://www.gitignore.io/api/node,macos 140 | lib 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `get-all-css-properties` 2 | 3 | [![source](./img/tweet.png)](https://twitter.com/tlakomy/status/1211695059055316994) 4 | 5 | A little CLI to get all the CSS properties sorted alphabetically and display it in your terminal, or to do whatever you want. 6 | 7 | ## k but why 8 | 9 | for the lulz 10 | 11 | ## Usage 12 | 13 | If you want to like use it in your project (i dunno why), you can actually import it and use it like 14 | 15 | ```js 16 | import { getAllCSSProperties } from "get-all-css-properties"; 17 | 18 | const sup = async () => { 19 | const allThePropertiesLOL = await getAllCSSProperties(); // returns an array of properties 20 | 21 | allThePropertiesLOL.forEach(doCoolStuff); 22 | }; 23 | ``` 24 | 25 | I legit just made this for fun but who knows 26 | 27 | ## One More Thing... 28 | 29 | I legit love you everyone. 30 | 31 | [Say hi?](https://twitter.com/tejaskumar_) 32 | -------------------------------------------------------------------------------- /img/tweet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TejasQ/get-all-css-properties/230f346e47c479f78d5feac4890681fa825b6c97/img/tweet.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get-all-css-properties", 3 | "description": "A npm module to list all the CSS properties alphabetically.", 4 | "keywords": [ 5 | "css" 6 | ], 7 | "bugs": { 8 | "email": "tejas@tejas.qa" 9 | }, 10 | "files": [ 11 | "lib" 12 | ], 13 | "author": { 14 | "email": "tejas@tejas.qa", 15 | "name": "Tejas Kumar", 16 | "url": "https://twitter.com/tejaskumar_" 17 | }, 18 | "contributors": [ 19 | "tejaskumar", 20 | "robinpokorny" 21 | ], 22 | "repository": { 23 | "url": "git@github.com:TejasQ/get-all-css-properties.git", 24 | "type": "git" 25 | }, 26 | "scripts": { 27 | "build": "tsc", 28 | "preversion": "tsc" 29 | }, 30 | "version": "1.0.5", 31 | "main": "./lib/getAllCSSProperties.js", 32 | "bin": "./lib/index.js", 33 | "license": "MIT", 34 | "engines": { 35 | "node": ">=12.0.0" 36 | }, 37 | "dependencies": { 38 | "node-fetch": "^2.6.0" 39 | }, 40 | "devDependencies": { 41 | "@types/node-fetch": "^2.5.4", 42 | "typescript": "^3.8.0-dev.20191228" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/getAllCSSProperties.ts: -------------------------------------------------------------------------------- 1 | import fetch from "node-fetch"; 2 | 3 | const IGNORED_PROPERTIES = ["--*"]; 4 | 5 | export const getAllCSSProperties = async () => { 6 | // Use Set to ignore repeating properties and sort them alphabetically. 7 | const properties = new Set(); 8 | try { 9 | const response = await fetch( 10 | "https://www.w3.org/Style/CSS/all-properties.en.json" 11 | ); 12 | const allProperties = await response.json(); 13 | // Safety check to make sure that parsed data is actually an array. 14 | if (Array.isArray(allProperties)) { 15 | /** 16 | * CSS properties data is an array of object in the following shape: 17 | * [ 18 | * { 19 | * property: '--*', 20 | * url: 'http://www.w3.org/TR/2015/CR-css-variables-1-20151203/#propdef-', 21 | * status: 'CR', 22 | * title: 'CSS Custom Properties for Cascading Variables Module Level 1' 23 | * }, 24 | * ... 25 | * ], 26 | * We have to omit some properties that are not relevant. 27 | */ 28 | allProperties.forEach( 29 | property => 30 | !IGNORED_PROPERTIES.includes(property.property) && 31 | properties.add(property.property) 32 | ); 33 | } 34 | } catch (error) { 35 | // Handle errors. 36 | } 37 | return Array.from(properties.values()); 38 | }; 39 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { getAllCSSProperties } from "./getAllCSSProperties"; 3 | 4 | console.log("Getting all CSS properties..."); 5 | getAllCSSProperties().then(cssProperties => { 6 | console.clear(); 7 | console.log("- " + cssProperties.join("\n- ")); 8 | console.log(` 9 | There you go! 10 | 11 | 12 | Made with ❤️ by 13 | https://twitter.com/tejaskumar_ 14 | for 15 | https://twitter.com/tlakomy`); 16 | }); 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, 6 | "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, 7 | "lib": ["es2020.string"] /* Specify library files to be included in the compilation. */, 8 | // "allowJs": true, /* Allow javascript files to be compiled. */ 9 | // "checkJs": true, /* Report errors in .js files. */ 10 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 11 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 12 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 13 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 14 | // "outFile": "./", /* Concatenate and emit output to single file. */ 15 | "outDir": "./lib" /* Redirect output structure to the directory. */, 16 | "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, 17 | // "composite": true, /* Enable project compilation */ 18 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 19 | // "removeComments": true, /* Do not emit comments to output. */ 20 | // "noEmit": true, /* Do not emit outputs. */ 21 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 22 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 23 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 24 | 25 | /* Strict Type-Checking Options */ 26 | "strict": true /* Enable all strict type-checking options. */, 27 | "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, 28 | "strictNullChecks": true /* Enable strict null checks. */, 29 | "strictFunctionTypes": true /* Enable strict checking of function types. */, 30 | "strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */, 31 | "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, 32 | "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, 33 | "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, 34 | 35 | /* Additional Checks */ 36 | "noUnusedLocals": true /* Report errors on unused locals. */, 37 | "noUnusedParameters": true /* Report errors on unused parameters. */, 38 | "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, 39 | "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, 40 | 41 | /* Module Resolution Options */ 42 | "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, 43 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 44 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 45 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 46 | // "typeRoots": [], /* List of folders to include type definitions from. */ 47 | // "types": [], /* Type declaration files to be included in compilation. */ 48 | "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, 49 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, 50 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 51 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 52 | 53 | /* Source Map Options */ 54 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 55 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 56 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 57 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 58 | 59 | /* Experimental Options */ 60 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 61 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 62 | 63 | /* Advanced Options */ 64 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@types/node-fetch@^2.5.4": 6 | version "2.5.4" 7 | resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.4.tgz#5245b6d8841fc3a6208b82291119bc11c4e0ce44" 8 | integrity sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ== 9 | dependencies: 10 | "@types/node" "*" 11 | 12 | "@types/node@*": 13 | version "13.1.2" 14 | resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.2.tgz#fe94285bf5e0782e1a9e5a8c482b1c34465fa385" 15 | integrity sha512-B8emQA1qeKerqd1dmIsQYnXi+mmAzTB7flExjmy5X1aVAKFNNNDubkavwR13kR6JnpeLp3aLoJhwn9trWPAyFQ== 16 | 17 | node-fetch@^2.6.0: 18 | version "2.6.0" 19 | resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" 20 | integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== 21 | 22 | typescript@^3.8.0-dev.20191228: 23 | version "3.8.0-dev.20191228" 24 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.0-dev.20191228.tgz#4dffeba86cce454d360e13d5ce15ffd154ee4dc1" 25 | integrity sha512-CPI/TQwKBaVFohrH5IwD/RbWJ6Syz9OJdchoL+cwH2rc02kgui7VPuEPDm1m1krddtEJiiMAc2icpPN0iWzggA== 26 | --------------------------------------------------------------------------------