daisyui 2.3.4 → 2.3.7-alpha.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 -1
- package/dist/full.css +1 -1
- package/dist/styled.css +1262 -302
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/dist/unstyled.css +351 -104
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.rtl.js +1 -1
- package/dist/utilities-styled.js +1 -1
- package/dist/utilities-unstyled.js +1 -1
- package/package.json +7 -7
- package/src/index.js +31 -12
package/src/index.js
CHANGED
|
@@ -10,8 +10,6 @@ let utilitiesUnstyled = require("../dist/utilities-unstyled");
|
|
|
10
10
|
let utilitiesStyled = require("../dist/utilities-styled");
|
|
11
11
|
const themes = require("./colors/themes");
|
|
12
12
|
const colorFunctions = require("./colors/functions");
|
|
13
|
-
const postcssJs = require('postcss-js');
|
|
14
|
-
// const postcssPrefix = require('postcss-class-prefix');
|
|
15
13
|
|
|
16
14
|
const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
17
15
|
let diasyuiIncludedItems = [];
|
|
@@ -65,10 +63,25 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
// add prefix to class names if specified
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
const prefix = config("daisyui.prefix")
|
|
67
|
+
let postcssJs, postcssPrefix
|
|
68
|
+
if (prefix) {
|
|
69
|
+
try {
|
|
70
|
+
postcssJs = require("postcss-js")
|
|
71
|
+
postcssPrefix = require("postcss-prefixer")
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (logs) {
|
|
74
|
+
console.error(`Error occurred and prevent applying the "prefix" option:`, error)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const shouldApplyPrefix = prefix && postcssPrefix && postcssJs;
|
|
79
|
+
if (shouldApplyPrefix) {
|
|
80
|
+
file = postcssJs.sync(postcssPrefix({
|
|
81
|
+
prefix: prefix,
|
|
82
|
+
ignore: []
|
|
83
|
+
}))(file)
|
|
84
|
+
}
|
|
72
85
|
|
|
73
86
|
addComponents(file);
|
|
74
87
|
|
|
@@ -80,13 +93,19 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
|
80
93
|
// inject @utilities style needed by components
|
|
81
94
|
if (config("daisyui.utils") != false) {
|
|
82
95
|
addComponents(utilities, { variants: ["responsive"] });
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
if (shouldApplyPrefix) {
|
|
97
|
+
utilitiesUnstyled = postcssJs.sync(postcssPrefix({
|
|
98
|
+
prefix: prefix,
|
|
99
|
+
ignore: []
|
|
100
|
+
}))(utilitiesUnstyled)
|
|
101
|
+
}
|
|
86
102
|
addComponents(utilitiesUnstyled, { variants: ["responsive"] });
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
if (shouldApplyPrefix) {
|
|
104
|
+
utilitiesStyled = postcssJs.sync(postcssPrefix({
|
|
105
|
+
prefix: prefix,
|
|
106
|
+
ignore: []
|
|
107
|
+
}))(utilitiesStyled)
|
|
108
|
+
}
|
|
90
109
|
addComponents(utilitiesStyled, { variants: ["responsive"] });
|
|
91
110
|
diasyuiIncludedItems.push("utilities");
|
|
92
111
|
}
|