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

Allow classes like a:b/c with @@ #950

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Conversation

xukai92
Copy link
Contributor

@xukai92 xukai92 commented Mar 9, 2022

Tailwind CSS (https://tailwindcss.com/) is a perfect match for @@ but it has a many class names like hover:basis-1/2 that the parser failed to reconize due to pre-matured end-of-token.
This PR fixes this issue.

@tlienart
Copy link
Owner

Nice one, thanks @xukai92, happy to add that, also this should still work fine with

# parse @@c1,c2,c3 as class="c1 c2 c3"
return html_div(replace(divname, ","=>" "), cont)

so should be good. I'll add a note in the docs and will do a patch release with it.

Ps: will be good to see what you do with tailwind, do you already have a repo?

@tlienart tlienart merged commit 93ed2ed into tlienart:master Mar 10, 2022
@xukai92
Copy link
Contributor Author

xukai92 commented Mar 10, 2022

I'm currently re-building the Turing.jl website using Franklin.jl.
Temporary repo at https://github.com/xukai92/beta.turing.ml and can be viewed at https://xukai92.github.io/beta.turing.ml/.
The site is still at a very initial stage but you can see how I'm using Tailwind in the index.md file---I think it works really nice with the @@ syntax.

@tlienart
Copy link
Owner

Nice one, so you'll use the base tailwind.min.css and then use purgecss at a later stage? I'm experimenting with all this in another repo so we can share knowledge if you want. I'll keep an eye on your repo for sure :)

@tlienart
Copy link
Owner

Ah no I see https://github.com/xukai92/beta.turing.ml/commit/51cf53527454bc8110d97dc66fa9f79b65406172

I played a bit with tailwindcss but wasn't using their JS build, rather just using the full CSS for development, then using purgecss to trim it down to a few kb post build.

@xukai92
Copy link
Contributor Author

xukai92 commented Mar 11, 2022

I think what you do is the recommanded way from Tailwind's offical website---I simply did the easiest thing to get started.
Can you set it up to purgecss when deployment?

@tlienart
Copy link
Owner

tlienart commented Mar 11, 2022

So what I do (I personally prefer bootstrap but tried tailwind to check):

  • have the full blown mega CSS file in _css (the tailwind one is something ridiculous like 3MB)
  • do stuff locally until happy
  • in the deploy script after the optimize, use NodeJS to install purgecss then call it

Note: with tailwind the purgecss default extractor doesn't work well, you have to change the regex a little bit to include :

This is the config file I used with the tailwind case: https://github.com/tlienart/GLEPlot.jl/blob/docs2/docs2/tailwind.config.js

The result is usually under 10kb

@xukai92
Copy link
Contributor Author

xukai92 commented Mar 11, 2022

That's super useful! Thanks for sharing this!

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

Successfully merging this pull request may close these issues.

2 participants