[英]How to get default config of tailwind CSS 2
Tailwind CSS 2.x顺风 CSS 2.x
I want to get the default height values of the height
config.我想获取height
配置的默认高度值。
const defaultConfig = require('tailwindcss/defaultConfig');
const height = defaultConfig.theme.height;
But height is a function, as one can see in the source code:但是高度是 function,正如在源代码中所见:
// tailwindcss/stubs/defaultConfig.stub.js
module.exports = {
// ...
theme: {
// ...
height: (theme) => ({
auto: 'auto',
...theme('spacing'),
'1/2': '50%',
'1/3': '33.333333%',
}),
},
};
I understand the code: a theme
function is passed which then is called to get other config parts of the theme.我理解代码:传递了一个theme
function ,然后调用它来获取主题的其他配置部分。
But I don't know what this function is and where to find it so I can import it in my config and pass it as this:但我不知道这个 function 是什么以及在哪里可以找到它,所以我可以将它导入到我的配置中并将其传递为:
defaultConfig.theme.height(thisIsTheFunctionInQuestion)
Where can I find it?我在哪里可以找到它?
In order to resolve any tailwind configuration object, use resolveConfig()
helper method为了解决任何顺风配置 object,使用resolveConfig()
辅助方法
import resolveConfig from 'tailwindcss/resolveConfig'
import defaultConfig from 'tailwindcss/defaultConfig'
const config = resolveConfig(defaultConfig)
console.log(config.theme.height) // will return object
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.