Skip to content

Commit

Permalink
Add explanation of why you might not want to include PhlexyUI in Appl…
Browse files Browse the repository at this point in the history
…icationComponent
  • Loading branch information
davidalejandroaguilar committed Oct 10, 2024
1 parent e20c4c7 commit 4a84157
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,45 @@ Install Phlex by following the instructions in the [Phlex documentation](https:/
bundle add phlexy_ui
```

2. Include the `PhlexyUI` module in `ApplicationComponent`:
2. (Optional) Include the `PhlexyUI` module in `ApplicationComponent`:

```rb
class ApplicationComponent < Phlex::HTML
include PhlexyUI
end
```

This will allow you to use PhlexyUI components using the short-form syntax. For example:

```rb
class SomeView < ApplicationView
def view_template
Button :primary do
"Hello, world!"
end
end
end
```

If you don't include PhlexyUI, you can still use the namespaced syntax:

```rb
class SomeView < ApplicationView
def view_template
PhlexyUI::Button :primary do
"Hello, world!"
end
end
end
```

Consider not including PhlexyUI in ApplicationComponent if:

- You have your own component library with the same component names as PhlexyUI.
- You're including your own components module in `ApplicationComponent`.

In this scenario, including both PhlexyUI and your own component library in `ApplicationComponent` will lead to naming conflicts.

3. Update your `tailwind.config.js` file to include PhlexyUI styles:

```js
Expand Down

0 comments on commit 4a84157

Please sign in to comment.