tailwindcss 1.4.5 → 1.4.6
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/lib/util/processPlugins.js +14 -0
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ var _wrapWithVariants = _interopRequireDefault(require("../util/wrapWithVariants
|
|
|
27
27
|
|
|
28
28
|
var _increaseSpecificity = _interopRequireDefault(require("../util/increaseSpecificity"));
|
|
29
29
|
|
|
30
|
+
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
function parseStyles(styles) {
|
|
@@ -37,6 +39,14 @@ function parseStyles(styles) {
|
|
|
37
39
|
return _lodash.default.flatMap(styles, style => style instanceof _node.default ? style : (0, _parseObjectStyles.default)(style));
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
function containsClass(value) {
|
|
43
|
+
return (0, _postcssSelectorParser.default)(selectors => {
|
|
44
|
+
let classFound = false;
|
|
45
|
+
selectors.walkClasses(() => classFound = true);
|
|
46
|
+
return classFound;
|
|
47
|
+
}).transformSync(value);
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
function _default(plugins, config) {
|
|
41
51
|
const pluginBaseStyles = [];
|
|
42
52
|
const pluginComponents = [];
|
|
@@ -110,6 +120,10 @@ function _default(plugins, config) {
|
|
|
110
120
|
if (config.important === true) {
|
|
111
121
|
rule.walkDecls(decl => decl.important = true);
|
|
112
122
|
} else if (typeof config.important === 'string') {
|
|
123
|
+
if (containsClass(config.important)) {
|
|
124
|
+
throw rule.error(`Classes are not allowed when using the \`important\` option with a string argument. Please use an ID instead.`);
|
|
125
|
+
}
|
|
126
|
+
|
|
113
127
|
rule.selectors = rule.selectors.map(selector => {
|
|
114
128
|
return (0, _increaseSpecificity.default)(config.important, selector);
|
|
115
129
|
});
|