How do I add animate-pulse to Blazor project? #17609
Unanswered
RobinAinscough
asked this question in
Help
Replies: 1 comment 6 replies
-
Adam Wathan (creator of Tailwind) does seem to advocate avoiding
Instead, consider adding the classes that you would <div class="animate-pulse text-red-600 text-lg font-semibold"> As for your broken styles, consider checking the |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
All I'm trying to do is add Tailwind "animate pulse" to my Blazor Project, what I thought would be relatively simple task (I was wrong).
I inherited a blazor project using Tailwind v3.3.5. There is a styles.src.css but it seem to have limited definitions and/or selective use of some but not all of Tailwind definitions? For example styles.src.css will have a selector:
.form-display {
@apply shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-200 rounded-md;
}
My limited understanding, if I want to add more Tailwind functionality to my Blazor project I need to update the styles.src.css with the Tailwind feature I want? Example, I want to add animate-pulse so I was going to add the following to styles.src.css:
.text-pulse {
@apply animate-pulse text-red-600 text-lg font-semibold;
}
And now from console window (in my solutions root) I run:
npx tailwindcss -i .\Styles\styles.src.css -o .\wwwroot\css\styles.css
After looking at the generated styles.css, it's considerably different post NPX execution from the original (like VERY different). And significant parts of the app's UI are now broken or visually different.
Looking in my project dependencies for NPM and I see the following listed:
@tailwindcss/forms (0.5.3)
@tailwindcss/typography (0.5.9)
autoprefixer (10.4.14)
postcss (8.4.31)
tailwindcss (3.3.5)
Like I said, I inherited this and the contractor indicated all I need to do is run NPM RUN DEV ... this doesn't seem to be correct.
The tailwind.config.js is as follows:
module.exports = {
content: [
'./Components//*.{html,cshtml,razor}',
'./Pages//.{html,cshtml,razor}',
'./Shared/**/.{html,cshtml,razor}',
'../Library.Components/**/*.{html,cshtml,razor}',
],
theme: {
extend: {
},
},
plugins: [
require('@tailwindcss/typography'),
require('@tailwindcss/forms'),
],
}
The postcss.config.js is as follows:
// postcss.config.js
module.exports = {
plugins: [
tailwindcss: {},
autoprefixer: {},
]
}
The package.json is as follows:
{
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.31",
"tailwindcss": "^3.3.5"
},
"dependencies": {
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9"
},
"scripts": {
"dev": "npx tailwindcss -i ./Styles/styles.src.css -o ./wwwroot/css/styles.css",
"watch": "npx tailwindcss -i ./Styles/styles.src.css -o ./wwwroot/css/styles.css --watch",
"prod": "NODE_ENV=production npx tailwindcss -i ./Styles/styles.src.css -o ./wwwroot/css/styles.min.css --minify"
}
}
The _Host.csthml has following css references:
I've not been successful at finding any documentation that would be helpful on Tailwind integration into Blazor-Server projects with .NET 9. I've tried to get assistance, but even with $799 payment it seems Tailwind is "self-support" hence my posts.
Any suggestions on how to simply add "animate pulse" to my Blazor project without wiping out all the exist CSS?
Thanks, Rob.
Beta Was this translation helpful? Give feedback.
All reactions