Skip to content

Feature Request: Include classes from content in compiling #391

Open
@Dorf

Description

@Dorf

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions