source: frontend/node_modules/tailwindcss/lib/util/resolveConfigPath.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.2 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", {
3 value: true
4});
5function _export(target, all) {
6 for(var name in all)Object.defineProperty(target, name, {
7 enumerable: true,
8 get: all[name]
9 });
10}
11_export(exports, {
12 default: function() {
13 return resolveConfigPath;
14 },
15 resolveDefaultConfigPath: function() {
16 return resolveDefaultConfigPath;
17 }
18});
19const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
20const _path = /*#__PURE__*/ _interop_require_default(require("path"));
21function _interop_require_default(obj) {
22 return obj && obj.__esModule ? obj : {
23 default: obj
24 };
25}
26const defaultConfigFiles = [
27 "./tailwind.config.js",
28 "./tailwind.config.cjs",
29 "./tailwind.config.mjs",
30 "./tailwind.config.ts",
31 "./tailwind.config.cts",
32 "./tailwind.config.mts"
33];
34function isObject(value) {
35 return typeof value === "object" && value !== null;
36}
37function isEmpty(obj) {
38 return Object.keys(obj).length === 0;
39}
40function isString(value) {
41 return typeof value === "string" || value instanceof String;
42}
43function resolveConfigPath(pathOrConfig) {
44 // require('tailwindcss')({ theme: ..., variants: ... })
45 if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
46 return null;
47 }
48 // require('tailwindcss')({ config: 'custom-config.js' })
49 if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
50 return _path.default.resolve(pathOrConfig.config);
51 }
52 // require('tailwindcss')({ config: { theme: ..., variants: ... } })
53 if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
54 return null;
55 }
56 // require('tailwindcss')('custom-config.js')
57 if (isString(pathOrConfig)) {
58 return _path.default.resolve(pathOrConfig);
59 }
60 // require('tailwindcss')
61 return resolveDefaultConfigPath();
62}
63function resolveDefaultConfigPath() {
64 for (const configFile of defaultConfigFiles){
65 try {
66 const configPath = _path.default.resolve(configFile);
67 _fs.default.accessSync(configPath);
68 return configPath;
69 } catch (err) {}
70 }
71 return null;
72}
Note: See TracBrowser for help on using the repository browser.