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

[FEATURE] "Inline" all classes to better work with tailwindcss #2

Closed
rowild opened this issue May 9, 2020 · 3 comments
Closed

[FEATURE] "Inline" all classes to better work with tailwindcss #2

rowild opened this issue May 9, 2020 · 3 comments
Assignees

Comments

@rowild
Copy link

rowild commented May 9, 2020

Hi!

first of all: thank you for your very helpful tool! Highly appreciated!

I only switched to pug yesterday (coming from ejs, all in a webpack context), but so far I am very happy with it. I only observe one thing that I would like to mention, and maybe you find a moment to share your opinion on that.

I use html pre-processors mainly to develop an initial webpage layout that will later be implemented in a CMS (TYPO3, the templates there are called "Fluid templates"). That means I have to rebuild the templates again in the CMS, which is ok by me, since lots of things are simply copy and paste.
Now, with pug however, that changes a bit, especially when in comes to classes and using tailwind. When converting html to pug, html2pug extracts css in dot notation, except where it encounters tailwindcss specials like md:w-1/2 or similar. Then the converter creates a class attribute, which is great.

But eventually I end up with 2 ways of css notation in the new pug file, which look like this, e.g.:

.gallery-unit.relative.inline-block.bg-gray-100.ml-2.whitespace-normal.align-top.h-60.rounded.shadow-simple.transition-shadow.duration-300(class='w-2/3 sm:w-1/2 md:w-1/3 lg:w-1/4 md:ml-6 lg:ml-8 lg:h-72 hover:shadow-simpleHover')

It would be way simpler to have everything in the class attribute like this:

.(class='gallery-unit relative inline-block bg-gray-100 ml-2 whitespace-normal align-top h-60 rounded shadow-simple transition-shadow duration-300 w-2/3 sm:w-1/2 md:w-1/3 lg:w-1/4 md:ml-6 lg:ml-8 lg:h-72 hover:shadow-simpleHover')

That would make it easier to copy classes over to another template system, and, IMO, it is also easier to read in the editor.

I wonder if it would be possible to have a configuration option available? E.g.:

Inline all CSS

Would love to know your opinion about that! Thank you!

@dimensi
Copy link
Owner

dimensi commented May 9, 2020

Hmm, I use the html2jade library for transformation. It is no longer supported by the author. But I think I can finalize this feature myself.

@dimensi dimensi self-assigned this May 9, 2020
@dimensi
Copy link
Owner

dimensi commented May 10, 2020

@rowild, I added a new feature. Here you go.
Close the issue if it's okay.

@dimensi dimensi changed the title [QUESTION / FEATURE PROPOSAL?] "Inline" all classes to better work with tailwindcss [FEATURE] "Inline" all classes to better work with tailwindcss May 10, 2020
@rowild
Copy link
Author

rowild commented May 10, 2020

@dimensi This is amazing! Thank you very, very much!

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

No branches or pull requests

2 participants