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

Add Phlex components to Tailwind configuration #271

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

alexandreruban
Copy link
Collaborator

@alexandreruban alexandreruban commented Oct 17, 2022

Phlex components are Ruby files, so they have a .rb extension.

That's why, to be able to use Phlex components with Tailwind, we need to add the .rb extension to the list of files that Tailwind should look at when generating CSS.

This is done in the config/tailwind.config.js:

module.exports = {
  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',
    './app/views/**/*.{slim,erb}',
  ],

Thanks to this commit, we automatically add the following configuration line to add .rb files in app/views to the list of files processed by Tailwind. Running rails phlex:install will add './app/views/**/*.rb', to the list:

 module.exports = {
   content: [
+    './app/views/**/*.rb',
     './public/*.html',
     './app/helpers/**/*.rb',
     './app/javascript/**/*.js',
     './app/views/**/*.{slim,erb}',
   ],
 }

Phlex components are Ruby files, so they have a `.rb` extension.

That's why, to be able to use Phlex components with Tailwind, we need
to add the `.rb` extension to the list of files that Tailwind should
look at when generating CSS.

This is done in the `config/tailwind.config.js`:

```js
module.exports = {
  content: [
    // ...
    './app/views/**/*.{erb,haml,html,slim,rb}'
  ]
}
```

Thanks to this commit, we automatically add the `.rb` extension to the
list of extensions when it is not already present.
@alexandreruban alexandreruban marked this pull request as ready for review October 18, 2022 19:46
@joeldrapper joeldrapper merged commit 64dd283 into phlex-ruby:main Oct 18, 2022
@alexandreruban alexandreruban deleted the tailwind-configuration branch October 18, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants