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

Question - What is the proper way to organize subdomain-specific components ? #168

Open
tdutreui opened this issue Aug 10, 2020 · 0 comments

Comments

@tdutreui
Copy link

tdutreui commented Aug 10, 2020

Hi guys :) Hope you're fine !
First, thank you for this very nice gem.

I'm currently setting up Komponent 2.2.0 in our Rails app with subdomains and I would like to completely dissociate their frontends, let's say :

domain.net
pro.domain.net

Problem : With 2 different komponent root directories, a conflict regarding the components ruby classes occurs because the modules have the same name.

Example for an "icon" component :

./frontend/components/icon/_icon.html.slim
./frontend-pro/components/icon/_icon.html.slim

Using component 'icon' on the pro subdomain views resolves the ruby class IconComponent of ./frontend instead of ./frontend-pro. The _icon.html.slim partial is correctly resolved (using prepend_view_path as stated in your doc)

I guess I should not change Rails.application.config.komponent.component_paths using before_action in a "pro" controller since its shared between subdomains, and changing global config on each request seems dangerous.

I would like to avoid namespacing my entire 'pro' component directory like ./frontend-pro/components/pro/icon/_pro_icon.html.slim since it does not look clean.

What do you advise?

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

No branches or pull requests

1 participant