vic*_*usP 6 nomachine-nx reactjs tailwind-css
我使用 React 和 TailwindCSS 为自定义组件创建了 NX 库。
它具有基本的 NX 汇总设置。
我尝试向我添加自定义颜色,tailwind.config.js如下所示:
const { createGlobPatternsForDependencies } = require('@nrwl/react/tailwind');
const { join } = require('path');
module.exports = {
content: [
join(__dirname, 'src/**/!(*.stories|*.spec).{ts,tsx,html}'),
...createGlobPatternsForDependencies(__dirname),
],
theme: {
extend: {
colors: {
'black-1': `#123`,
},
},
}
plugins: [],
};
Run Code Online (Sandbox Code Playgroud)
postcss.config.js
const { join } = require('path');
module.exports = {
plugins: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
},
};
Run Code Online (Sandbox Code Playgroud)
当我使用自定义颜色来设置组件样式时,我的库抛出(在构建时)
bg-black-1 was not found
Run Code Online (Sandbox Code Playgroud)
当我尝试在 nx 应用程序中使用此库中的组件时,它也会引发错误并且应用程序被破坏。但是,当我将库中使用的颜色添加到应用程序中的顺风配置时,一切都工作得很好。
我需要将该库分开并在不更改应用程序配置的情况下工作。
| 归档时间: |
|
| 查看次数: |
791 次 |
| 最近记录: |