docs icon indicating copy to clipboard operation
docs copied to clipboard

Feature Request: Include classes from content in compiling

Open Dorf opened this issue 3 years ago • 1 comments

Terms

Summary

I would appreciate guidance on Tailwind & Wordpress blocks in the Roots Docs, and best practices about classes in content.

I added an add_action in setup.php, to put page content into a folder in views

add_action('save_post', function ($post_id, $post) {
    if($post->post_type === 'page') {
        $filename = get_template_directory() . '/resources/views/content/' . $post->post_type . 's/' . $post_id . '.html';
        file_put_contents($filename, $post->post_content);
    }
}, 10, 2);

And I updated tailwind config include "html"

  content: ['./app/**/*.php', './resources/**/*.{php,vue,js,html}'],

Motivation

Why are we doing this?

Tailwind classes added to pages will get compiled

As an added benefit, when in a dev session, assets are compiled when saving a page

What use cases does it support?

supports yarn build & yarn dev

What is the expected outcome?

Tailwind classes in content get compiled

Potential conflicts / foreseeable issues

Potentially a large number of files and content to be parsed, especially if expanded to posts or products

Additional Context

Thank you Roots

Dorf avatar Mar 26 '22 18:03 Dorf

https://github.com/broskees/gutenberg-tailwind-safelist

retlehs avatar Apr 25 '23 14:04 retlehs