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

Workflow/Configuration for purge #103

Open
chriswedgwood opened this issue Jul 29, 2021 · 6 comments
Open

Workflow/Configuration for purge #103

chriswedgwood opened this issue Jul 29, 2021 · 6 comments

Comments

@chriswedgwood
Copy link
Contributor

Hi thanks for the project

I have an issue where I am using the purge option for my templates

module.exports = {
  purge: {

   content: ['./**/templates/**/*.html'],
   safelist: ['underline','cursor-pointer','grid-cols-3','gap-1','grid-cols-2'],

},

The css for the templates is not being applied when I deploy to prod
If I am using the crispy template pack fields do I just need to add a path to my content that will be for the path to the templates in site packages?

@smithdc1
Copy link
Member

Hi @chriswedgwood hope you are well. Love your work on Django snippets. ♥️

Umm.. so... There's a purge option? 🕵️

I'm really happy to investigate but I've not come across this, I'm still learning lots about Django!

Maybe it is not possible but is there a small test project you could share that shows this issue?

Take care.

@carltongibson
Copy link
Contributor

My initial thought is that maybe we could generate a safelist for the template pack. (These are the classes in use.)

@chriswedgwood
Copy link
Contributor Author

Yes I did think about adding to the safelist. It wouldnt be that hard to generate it but it may make the config quite bloated.

Let me play around some more and I'll come back here with my findings/example.

@carltongibson
Copy link
Contributor

Can we get the output from the search from tailwind/purge I wonder?

@chriswedgwood
Copy link
Contributor Author

Okay this worked for me:

module.exports = {
  purge: {

   content: ['./**/templates/**/*.html','../envs/**/*.html'],
   safelist: ['underline','cursor-pointer','grid-cols-3','gap-1','grid-cols-2'],

}

In production my site-packages is under ../envs/.

The safelist is still required for class definitions defined in form Layouts e.g.

self.helper.label_class = (
            "font-noe text-sm font-normal leading-11 tracking-tight text-skin mt-6"
        )

Perhaps there is something we can do there to generate the safelist for those cases? What would be required dor this, a management command?

I'll add a documentation PR for this 👍

@michael-yin
Copy link

@chriswedgwood

I have added a documentation PR to talk about this problem, I think it might be better than safelist

Could you please check it?

Thx.

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

4 participants