Skip to content
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

Add support for rest of the CSS features and upgrade to 6.x.x #1

Closed
wants to merge 4 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/testing/data/*
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:n/recommended"],
"plugins": ["import", "unicorn"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"n/no-unpublished-import": [
"error",
{
"allowModules": ["diff"]
}
],
"n/no-extraneous-import": [
"error",
{
"allowModules": ["colors"]
}
]
}
}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
node_modules/
node_modules/
.idea
.vscode
.DS_Store
yarn-debug.log*
yarn-error.log*
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
.idea
.vscode
.DS_Store
yarn-debug.log*
yarn-error.log*
.eslintignore
.eslintrc.json
.github
.nvmrc
.prettierignore
.prettierrc
npm-debug.log
package-lock.json
testing
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/testing/data/*
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"trailingComma": "es5",
"overrides": [
{
"files": ["**/package.json"],
"options": {
"plugins": ["prettier-plugin-packagejson"]
}
}
]
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ The syntax of each CSS property (and other CSS items) is precisely defined using
## Usage

```js
import { getPropertySyntax } from "query-css-syntax";
import { getSyntax } from "query-css-syntax";

const typesToOmit = ["<color>"];
const syntax = getPropertySyntax("border-top", typesToOmit);
const syntax = getSyntax("border-top", "property", typesToOmit);

console.log(syntax);

Expand All @@ -35,7 +35,8 @@ console.log(syntax);

This package exports one function, `getPropertySyntax()`. This function takes two arguments:

- `propertyName`: the name of a CSS property
- `name`: the name of a CSS feature. For example, `color`, `var()`, `<paint>`, `@import`, `@font-face/font-family`.
- `type`: Type of the CSS feature. For example, `property`, `function`, `type`, `at-rule`, and `at-rule-descriptor`.
- `typesToOmit`: an array listing types for which you don't want the function to find subtypes. For example, the complete definition of `<color>` is very long, so it's usually better to link to a separate definition of it than to include the definition here.

The function returns an object with two properties:
Expand Down
21 changes: 18 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import { getPropertySyntax } from "./query-property-syntax.js";
import { getSyntax } from "./query-syntax.js";

const typesToOmit = [];
const helpMessage =
"Usage:\n\t" +
"npm run query-syntax '[feature-name]' '[feature-type]' '[typeToOmit]'...\n\t" +
"node cli.js '[feature-name]' '[feature-type]' '[typeToOmit]'...\n";

const syntax = getPropertySyntax(process.argv[2], typesToOmit);
if (process.argv.length < 4) {
console.error(helpMessage);
/* eslint-disable-next-line no-process-exit, n/no-process-exit */
process.exit(1);
} else if (process.argv[2] === "--help" || process.argv[2] === "-h") {
console.info(helpMessage);
/* eslint-disable-next-line no-process-exit, n/no-process-exit */
process.exit(0);
}

const syntax = getSyntax(process.argv[2], process.argv[3], [
...process.argv.slice(4),
]);

console.log(syntax);
113 changes: 0 additions & 113 deletions get-constituent-syntaxes.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./query-property-syntax.js";
export * from "./query-syntax.js";
Loading