nemcss 0.2.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +6 -6
- package/schemas/nemcss.config.schema.json +112 -116
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ Run `nemcss init` to scaffold a `nemcss.config.json` and example token files, th
|
|
|
31
31
|
| `nemcss init` | Scaffold `nemcss.config.json` and example token files in the current directory |
|
|
32
32
|
| `nemcss build -i <input> -o <output>` | One-shot build: scan content files and write CSS |
|
|
33
33
|
| `nemcss watch -i <input> -o <output>` | Watch mode: rebuild on token, content, or config changes |
|
|
34
|
+
| `nemcss schema` | Print the JSON schema for `nemcss.config.json` to stdout |
|
|
34
35
|
|
|
35
36
|
## Configuration
|
|
36
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nemcss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Command-line interface for nemcss, a design-token-driven CSS utility generator",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"schemas"
|
|
28
28
|
],
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@nemcss/cli-darwin-arm64": "0.
|
|
31
|
-
"@nemcss/cli-darwin-x64": "0.
|
|
32
|
-
"@nemcss/cli-linux-x64": "0.
|
|
33
|
-
"@nemcss/cli-linux-arm64": "0.
|
|
34
|
-
"@nemcss/cli-win32-x64": "0.
|
|
30
|
+
"@nemcss/cli-darwin-arm64": "0.5.0",
|
|
31
|
+
"@nemcss/cli-darwin-x64": "0.5.0",
|
|
32
|
+
"@nemcss/cli-linux-x64": "0.5.0",
|
|
33
|
+
"@nemcss/cli-linux-arm64": "0.5.0",
|
|
34
|
+
"@nemcss/cli-win32-x64": "0.5.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,138 +1,134 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
3
|
-
"title": "
|
|
4
|
-
"description": "
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "NemCssConfig",
|
|
4
|
+
"description": "NemCssConfig represents the configuration of the NemCSS util.\nIt contains the paths to the content files and the design tokens, as well as the theme configuration.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"content": {
|
|
8
|
+
"description": "Vector of glob patterns to determine which content files to target.\nContent files will be used to determine which CSS classes to generate.",
|
|
8
9
|
"type": "array",
|
|
9
|
-
"items": {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
}
|
|
12
13
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
14
|
+
"semantic": {
|
|
15
|
+
"description": "Semantic tokens",
|
|
16
|
+
"anyOf": [
|
|
17
|
+
{
|
|
18
|
+
"$ref": "#/$defs/SemanticConfig"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "null"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
17
24
|
},
|
|
18
25
|
"theme": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"defaultSnippets": [
|
|
26
|
+
"description": "Theme configuration.",
|
|
27
|
+
"anyOf": [
|
|
22
28
|
{
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"source": "${2:design-tokens/tokens.json}",
|
|
28
|
-
"prefix": "${3:prefix}"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
29
|
+
"$ref": "#/$defs/ThemeConfig"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "null"
|
|
31
33
|
}
|
|
32
|
-
]
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"tokensDir": {
|
|
37
|
+
"description": "Path to directory containing the design tokens.",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"default": "design-tokens"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"required": [
|
|
44
|
+
"content"
|
|
45
|
+
],
|
|
46
|
+
"$defs": {
|
|
47
|
+
"SemanticConfig": {
|
|
48
|
+
"description": "The semantic config enables the creation of groups of semantic tokens (e.g. for \"text\",\n\"background\") with their own configuration (e.g. the CSS property they target and the tokens\nthey use)",
|
|
49
|
+
"type": "object",
|
|
33
50
|
"additionalProperties": {
|
|
34
|
-
"
|
|
35
|
-
"required": ["source"],
|
|
36
|
-
"defaultSnippets": [
|
|
37
|
-
{
|
|
38
|
-
"label": "Token group config",
|
|
39
|
-
"body": {
|
|
40
|
-
"source": "${1:design-tokens/tokens.json}",
|
|
41
|
-
"prefix": "${2:prefix}"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"properties": {
|
|
46
|
-
"source": {
|
|
47
|
-
"type": "string",
|
|
48
|
-
"description": "Path to the token JSON file, relative to nemcss.config.json"
|
|
49
|
-
},
|
|
50
|
-
"prefix": {
|
|
51
|
-
"type": "string",
|
|
52
|
-
"description": "CSS custom property prefix for this token group"
|
|
53
|
-
},
|
|
54
|
-
"utilities": {
|
|
55
|
-
"type": "array",
|
|
56
|
-
"description": "Utility classes to generate for every token in this group",
|
|
57
|
-
"items": {
|
|
58
|
-
"type": "object",
|
|
59
|
-
"required": ["prefix", "property"],
|
|
60
|
-
"defaultSnippets": [
|
|
61
|
-
{
|
|
62
|
-
"label": "Utility",
|
|
63
|
-
"body": {
|
|
64
|
-
"prefix": "${1:p}",
|
|
65
|
-
"property": "${2:padding}"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"properties": {
|
|
70
|
-
"prefix": {
|
|
71
|
-
"type": "string",
|
|
72
|
-
"description": "CSS class prefix for this utility",
|
|
73
|
-
"minLength": 1
|
|
74
|
-
},
|
|
75
|
-
"property": {
|
|
76
|
-
"type": "string",
|
|
77
|
-
"description": "CSS property to set",
|
|
78
|
-
"minLength": 1
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"additionalProperties": false
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"additionalProperties": false
|
|
51
|
+
"$ref": "#/$defs/SemanticGroupConfig"
|
|
86
52
|
}
|
|
87
53
|
},
|
|
88
|
-
"
|
|
54
|
+
"SemanticGroupConfig": {
|
|
55
|
+
"description": "A single semantic token config",
|
|
89
56
|
"type": "object",
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
57
|
+
"properties": {
|
|
58
|
+
"property": {
|
|
59
|
+
"description": "CSS property this group targets (e.g. \"color\", \"background-color\")",
|
|
60
|
+
"type": "string",
|
|
61
|
+
"minLength": 1
|
|
62
|
+
},
|
|
63
|
+
"tokens": {
|
|
64
|
+
"description": "Mapping between a semantic name and an existing design token value\ne.g. \"primary\" -> \"{colors.blue-800}\"",
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": {
|
|
67
|
+
"type": "string"
|
|
102
68
|
}
|
|
103
69
|
}
|
|
104
|
-
|
|
70
|
+
},
|
|
71
|
+
"required": [
|
|
72
|
+
"property",
|
|
73
|
+
"tokens"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"ThemeConfig": {
|
|
77
|
+
"description": "ThemeConfig represents the configuration of the theme.\nIt contains the design tokens configuration per token type.",
|
|
78
|
+
"type": "object",
|
|
105
79
|
"additionalProperties": {
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
80
|
+
"$ref": "#/$defs/TokenConfig"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"TokenConfig": {
|
|
84
|
+
"description": "TokenConfig represents the configuration of a single design token.\nYou can override the default configuration by specifying the source, prefix, and utilities.\n\n# Examples\n\nIn your `nemcss.config.json`:\n\n```json\n{\n \"theme\": {\n \"colors\": {\n \"source\": \"design-tokens/colors.json\",\n \"prefix\": \"color\",\n \"utilities\": [\n {\n \"prefix\": \"highlight\",\n \"property\": \"background-color\"\n }\n ]\n }\n\n }\n}\n```\n\nWith a token variant \"primary\" in colors.json, this generates:\n- CSS custom property: `--color-primary`\n- Utility class: `.highlight-primary { background-color: var(--color-primary); }`",
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"prefix": {
|
|
88
|
+
"description": "The token prefix is used to generate the custom properties for the given token.\nFor example, if prefix is \"color\", the token prefix will be \"color-\".\nIf the color tokens include a \"primary\" variant, the custom property generated will be\n\"--color-primary\".",
|
|
89
|
+
"type": [
|
|
90
|
+
"string",
|
|
91
|
+
"null"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"source": {
|
|
95
|
+
"description": "Path to the tokens file.\nIt will make it possible to override the default configuration for a given token.",
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
"utilities": {
|
|
99
|
+
"description": "Utilities are used to generate utility classes for the given token.",
|
|
100
|
+
"type": [
|
|
101
|
+
"array",
|
|
102
|
+
"null"
|
|
103
|
+
],
|
|
104
|
+
"items": {
|
|
105
|
+
"$ref": "#/$defs/TokenUtilityConfig"
|
|
132
106
|
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": [
|
|
110
|
+
"source"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"TokenUtilityConfig": {
|
|
114
|
+
"description": "TokenUtilityConfig represents the configuration of a utility class for a given token.",
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"prefix": {
|
|
118
|
+
"description": "The prefix that will be used to generate the utility class.\nFor example, if the prefix is \"bg\", the utility class will be \"bg-[TOKEN VARIANT]\".",
|
|
119
|
+
"type": "string",
|
|
120
|
+
"minLength": 1
|
|
133
121
|
},
|
|
134
|
-
"
|
|
135
|
-
|
|
122
|
+
"property": {
|
|
123
|
+
"description": "The CSS property that will use the design token value.",
|
|
124
|
+
"type": "string",
|
|
125
|
+
"minLength": 1
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": [
|
|
129
|
+
"prefix",
|
|
130
|
+
"property"
|
|
131
|
+
]
|
|
136
132
|
}
|
|
137
133
|
}
|
|
138
134
|
}
|