anubis-ui 1.2.5 → 1.2.7
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
CHANGED
|
@@ -7,9 +7,7 @@ AnubisUI (Autonomous Nominative Utility Based Intuitive Styler) is a Vite plugin
|
|
|
7
7
|
> <br />
|
|
8
8
|
> Classes must be EXPLICITY written in the code to allow the extraction to work correctly, dynamic classes will not work
|
|
9
9
|
> <br />
|
|
10
|
-
>
|
|
11
|
-
> <br />
|
|
12
|
-
> Until then, you can create a decoy .vue file filled with the dynamic classes you want
|
|
10
|
+
> You can use the `force` configuration to generate specific classes even if they're not present in the code
|
|
13
11
|
> <br />
|
|
14
12
|
|
|
15
13
|
## Table of Contents
|
|
@@ -167,6 +165,13 @@ For every config you want to change, add the corresponding section in your confi
|
|
|
167
165
|
"thin": "2px"
|
|
168
166
|
}
|
|
169
167
|
}
|
|
168
|
+
],
|
|
169
|
+
|
|
170
|
+
// force.config.json
|
|
171
|
+
"force": [
|
|
172
|
+
"bg-primary-10",
|
|
173
|
+
"bg-primary-20",
|
|
174
|
+
"bg-primary-30"
|
|
170
175
|
]
|
|
171
176
|
}
|
|
172
177
|
```
|
|
@@ -342,6 +347,29 @@ Example usage:
|
|
|
342
347
|
<div class="rounded smooth" /> <!-- Works because these are standalone -->
|
|
343
348
|
```
|
|
344
349
|
|
|
350
|
+
### Force (`force.config.json`)
|
|
351
|
+
Force the generation of specific CSS classes even if they're not found in your code. This is particularly useful for dynamic classes that can't be detected during the extraction process.
|
|
352
|
+
|
|
353
|
+
<details>
|
|
354
|
+
<summary>Default config</summary>
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
[]
|
|
358
|
+
```
|
|
359
|
+
</details>
|
|
360
|
+
|
|
361
|
+
Example usage:
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"force": [
|
|
365
|
+
"bg-primary-10",
|
|
366
|
+
"bg-primary-20",
|
|
367
|
+
"bg-primary-30",
|
|
368
|
+
"hover:bg-secondary-50"
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
345
373
|
## Available Utility Classes
|
|
346
374
|
#### Colors
|
|
347
375
|
- `bg-{color}` - Background color
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { init: initConfig, config } = require('./dist/
|
|
3
|
+
const { init: initConfig, config } = require('./dist/tools/config.tool');
|
|
4
4
|
const { log, logPrefix, logo } = require('./dist/tools/logger');
|
|
5
5
|
const { init: initClassExtraction } = require('./dist/tools/extraction/extractClasses');
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anubis-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Class-based css generator",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"vue"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"dev": "npm run preinstall; node src/manual/build.js",
|
|
18
|
+
"dev": "rm -rf dist; npm run preinstall; node src/manual/build.js",
|
|
19
19
|
"build": "tsc",
|
|
20
20
|
"preinstall": "npm run build"
|
|
21
21
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IEnvConfig } from "../interfaces/config.interface";
|
|
2
|
-
import { readUserConfigFile, userConfig } from "
|
|
3
|
-
import { log } from "
|
|
2
|
+
import { readUserConfigFile, userConfig } from "./fileStuff/configFile"
|
|
3
|
+
import { log } from "./logger"
|
|
4
4
|
|
|
5
5
|
const fs = require('fs')
|
|
6
6
|
const path = require('path')
|
|
@@ -18,6 +18,8 @@ const config = {
|
|
|
18
18
|
qol: [],
|
|
19
19
|
presets: [],
|
|
20
20
|
|
|
21
|
+
force: [],
|
|
22
|
+
|
|
21
23
|
files: { targets: [], ignore: [] },
|
|
22
24
|
colors: [],
|
|
23
25
|
states: [],
|
|
@@ -37,6 +39,7 @@ const init = () => {
|
|
|
37
39
|
} else {
|
|
38
40
|
const filePath = path.join(anubisConfigFolder, `${file}.config.json`)
|
|
39
41
|
const configContent = fs.readFileSync(filePath, { encoding: 'utf-8' })
|
|
42
|
+
if (!configContent) { continue }
|
|
40
43
|
|
|
41
44
|
configToUse = JSON.parse(configContent)
|
|
42
45
|
}
|
|
@@ -44,6 +47,14 @@ const init = () => {
|
|
|
44
47
|
config[file as keyof typeof config] = configToUse
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
const forceClasses = userConfig?.['force']
|
|
51
|
+
console.log({ forceClasses })
|
|
52
|
+
|
|
53
|
+
if (forceClasses?.length) {
|
|
54
|
+
log(`Forcing the creation of ${forceClasses?.length} classes`)
|
|
55
|
+
config.force = userConfig['force']
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
return config
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -53,7 +64,7 @@ const checkUserConfig = () => {
|
|
|
53
64
|
// todo - also check values
|
|
54
65
|
const userConfigKeys = Object.keys(userConfig)
|
|
55
66
|
|
|
56
|
-
const unknownKeys = userConfigKeys?.filter(key => !anubisConfigFiles.includes(key))
|
|
67
|
+
const unknownKeys = userConfigKeys?.filter(key => !anubisConfigFiles.includes(key) && key !== 'force')
|
|
57
68
|
if (!unknownKeys?.length) { return }
|
|
58
69
|
|
|
59
70
|
log(`${unknownKeys?.length} unknown config keys found in user config file`)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFiles } from "../fileStuff/file.tools"
|
|
2
2
|
import { mapClassesIntoRules } from "../mapping/mapClassIntoRule"
|
|
3
3
|
import { buildCssRuleFile } from "../fileStuff/cssFile"
|
|
4
|
-
import { config } from "
|
|
4
|
+
import { config } from "../config.tool"
|
|
5
5
|
|
|
6
6
|
const fs = require('fs')
|
|
7
7
|
|
|
@@ -22,9 +22,10 @@ const getUniqueClasses = async (files: string[]): Promise<string[]> => {
|
|
|
22
22
|
files.map(async file => extractClasses(file))
|
|
23
23
|
))
|
|
24
24
|
?.flat()
|
|
25
|
-
?.sort()
|
|
26
25
|
|
|
27
|
-
const
|
|
26
|
+
const classes = [...extractedClasses, ...config.force]?.sort()
|
|
27
|
+
|
|
28
|
+
const uniqueClasses = Array.from(new Set(classes))
|
|
28
29
|
return uniqueClasses
|
|
29
30
|
}
|
|
30
31
|
|