Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up separate CSS file to use @apply? #16

Closed
monk-85 opened this issue Mar 22, 2020 · 5 comments
Closed

How to set up separate CSS file to use @apply? #16

monk-85 opened this issue Mar 22, 2020 · 5 comments

Comments

@monk-85
Copy link

monk-85 commented Mar 22, 2020

Hi Tim,

Thanks for building this Django integration!

What do I need to do to set up the equivalent of step two here to be able to use @apply, which happens in a separate CSS file? https://tailwindcss.com/docs/installation or in more detail: https://tailwindcss.com/course/composing-utilities-with-apply/

Many thanks

@timonweb
Copy link
Owner

Hey, thank you for letting me know the package helps. Well, basically, you don't need to do anything special, just edit the styles.scss files and your stuff there. Alternatively, you can import any scss file into styles.scss to keep things clean.

@monk-85
Copy link
Author

monk-85 commented Mar 22, 2020

OK, thank you for the fast reply!

And are you then using PurgeCSS at the end to avoid a 1mb CSS file? If so, what's the easiest way to set this up in the "Django-Tailwind-Stack"?

Sorry, I feel bad for asking all these newbie questions, must sound lazy. Just a bit brain-fried from setting everything up. Going from Bootstrap to Tailwind seems to be quite the jump for a beginner.

@timonweb
Copy link
Owner

no prob. No it doesn't spit 1mb css file. It's 300kb non-gzipped if you have the default config. We don't use PurgeCSS here as it's an optional thing that could be installed by a user. You need to figure this part out by yourself, I've never used PurgeCSS, maybe in the future I'll add support for it.

@monk-85
Copy link
Author

monk-85 commented Mar 22, 2020

OK thanks, I'll save figuring PurgeCSS out for another day, hah.

Regarding the file size - when I run "python manage.py tailwind build", I get a /static/css/styles.min.css file which is 825kb (Windows machine). Hmm.

@ghost
Copy link

ghost commented May 28, 2021

Hi, I can't figure out how to use @apply in my scss files. Is it still possible? All I have at the moment is a theme app with a static/css/dist/styles.css file (which seems to be the talwind default theme). How can I use @tailwind directives (in order to use @apply)? Which file should I edit (I can't find any scss file in the default created app)?

Edit: I figured out just now there is a file in static_rsc/src/styles.css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants