Closed 3gwebtrain closed 1 year ago
vite.config.ts:
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsConfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
server: {
port: 4200,
host: 'localhost',
},
plugins: [
react(),
viteTsConfigPaths({
root: './',
}),
],
test: {
globals: true,
cache: {
dir: './node_modules/.vitest',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
});
when i add this class as hardcoded, in the component for testing apart from loop,
<h1 className="text-secondary text-tertiary text-white text-5xl font-semibold"></h1>
in the loop classes as well works. If i remove then it goes... not clear with issue
I got one suggestion here:
As the reply on Stackoverflow suggests, this is not an Nx issue.
The recommendation I would make is for you to create you custom class names in your own CSS file.
e.g.
/* header.css */
.a {
@apply text-secondary text-5xl font-semibold;
}
.b {
@apply text-white text-5xl font-semibold;
}
.c {
@apply text-tertiary text-5xl font-semibold;
}
This way in your component you can use your custom class names a, b, c
(or whatever name you give them) and tailwind should keep the styles intact.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
No Style properties added to the element
Expected Behavior
all properties from className should be added after component rendered:
It's my json:
my header: where I apply my class names on loop:
`export const Header: FC<{ initials: InitialProps[] }> = ({ initials }) => { return (
{initial.label}
))}); };`
But in the browser I see all class names are applied. But no property update with element. If I hard code the classNames, instead of assign from json it works fine. I am using Nx workspace with vite for react app. the header placed under the header library.
in browser I see this:
Github Repo
[No response](https://github.com/3gwebtrain/portfolio)
Steps to Reproduce
1.
Nx Report
Failure Logs
No response
Additional Information
No response