daisyui 2.3.6 → 2.3.7-alpha.2

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +6 -5
  3. package/src/index.js +25 -17
package/README.md CHANGED
@@ -74,7 +74,7 @@ module.exports = {
74
74
  Loading CSS files from CDN is not recommended for production. It's better to install Tailwind and daisyUI as Nodejs dependencies so you can config/customize everything, and purge unused styles.
75
75
 
76
76
  ```html
77
- <link href="https://cdn.jsdelivr.net/npm/daisyui@2.3.5/dist/full.css" rel="stylesheet" type="text/css" />
77
+ <link href="https://cdn.jsdelivr.net/npm/daisyui@2.3.6/dist/full.css" rel="stylesheet" type="text/css" />
78
78
  <script src="https://cdn.tailwindcss.com"></script>
79
79
  ```
80
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daisyui",
3
- "version": "2.3.6",
3
+ "version": "2.3.7-alpha.2",
4
4
  "description": "daisyUI - Tailwind CSS Components",
5
5
  "author": "Pouya Saadeghi",
6
6
  "license": "MIT",
@@ -73,6 +73,7 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@parcel/css-cli": "^1.5.0",
76
+ "@types/css-selector-tokenizer": "^0.7.1",
76
77
  "autoprefixer": "10.0.4",
77
78
  "postcss-cli": "8.3.0",
78
79
  "postcss-import": "13.0.0",
@@ -82,12 +83,12 @@
82
83
  },
83
84
  "dependencies": {
84
85
  "color": "^4.2",
85
- "postcss": "^8.1.6",
86
+ "css-selector-tokenizer": "^0.8.0",
86
87
  "postcss-js": "^4.0.0",
87
- "postcss-prefixer": "^2.1.3",
88
88
  "tailwindcss": "^3.0"
89
89
  },
90
90
  "peerDependencies": {
91
- "autoprefixer": "^10.0.2"
91
+ "autoprefixer": "^10.0.2",
92
+ "postcss": "^8.1.6"
92
93
  }
93
- }
94
+ }
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-prefixer');
15
13
 
16
14
  const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
17
15
  let diasyuiIncludedItems = [];
@@ -65,12 +63,22 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
65
63
  }
66
64
 
67
65
  // add prefix to class names if specified
68
- const prefix = config('daisyui.prefix');
66
+ const prefix = config("daisyui.prefix")
67
+ let postcssJs, postcssPrefix
69
68
  if (prefix) {
70
- // file = postcssJs.sync(postcssPrefix({
71
- // prefix: prefix,
72
- // ignore: []
73
- // }))(file)
69
+ try {
70
+ postcssJs = require("postcss-js")
71
+ postcssPrefix = require('./lib/postcss-prefixer')
72
+ } catch (error) {
73
+ logs && console.error(`Error occurred and prevent applying the "prefix" option:`, error)
74
+ }
75
+ }
76
+ const shouldApplyPrefix = prefix && postcssPrefix && postcssJs
77
+ if (shouldApplyPrefix) {
78
+ file = postcssJs.sync(postcssPrefix({
79
+ prefix: prefix,
80
+ ignore: []
81
+ }))(file)
74
82
  }
75
83
 
76
84
  addComponents(file);
@@ -83,18 +91,18 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
83
91
  // inject @utilities style needed by components
84
92
  if (config("daisyui.utils") != false) {
85
93
  addComponents(utilities, { variants: ["responsive"] });
86
- if (prefix) {
87
- // utilitiesUnstyled = postcssJs.sync(postcssPrefix({
88
- // prefix: prefix,
89
- // ignore: []
90
- // }))(utilitiesUnstyled)
94
+ if (shouldApplyPrefix) {
95
+ utilitiesUnstyled = postcssJs.sync(postcssPrefix({
96
+ prefix: prefix,
97
+ ignore: []
98
+ }))(utilitiesUnstyled)
91
99
  }
92
100
  addComponents(utilitiesUnstyled, { variants: ["responsive"] });
93
- if (prefix) {
94
- // utilitiesStyled = postcssJs.sync(postcssPrefix({
95
- // prefix: prefix,
96
- // ignore: []
97
- // }))(utilitiesStyled)
101
+ if (shouldApplyPrefix) {
102
+ utilitiesStyled = postcssJs.sync(postcssPrefix({
103
+ prefix: prefix,
104
+ ignore: []
105
+ }))(utilitiesStyled)
98
106
  }
99
107
  addComponents(utilitiesStyled, { variants: ["responsive"] });
100
108
  diasyuiIncludedItems.push("utilities");