Errors when creating custom Foreman plugin

Hey there!
I’m having some issues creating my own custom plugin for my organization’s Foreman.
First, when following the guide to install the template, I’m getting the following error when trying to access my Foreman instance:

 6f1a3979 | ActionView::Template::Error (Can't find entry point 'my_plugin_name' in webpack manifest):
 6f1a3979 |     13:     <%= stylesheet_link_tag *webpack_asset_paths('foreman-vendor', :extension => 'css') %>
 6f1a3979 |     14:     <%= stylesheet_link_tag *webpack_asset_paths('bundle', :extension => 'css') %>
 6f1a3979 |     15:     <%= stylesheet_link_tag 'application' %>
 6f1a3979 |     16:     <%= webpacked_plugins_with_global_css %>
 6f1a3979 |     17:     <%= yield(:stylesheets) %>
 6f1a3979 |     18: 
 6f1a3979 |     19:     <%= csrf_meta_tags %>

Second, I’d like to reskin Forman without maintaining a fork. The best approach seems to be creating a plugin that could override files under app/assets and webpack/assets

I’ve tried to use existing, but out of date, plugins like foreman-theme and foreman-themify as examples and replicate how they replace things like stylesheets and images. By modifying the plugin templates engine.rb to do things like precompile assets I’ve made the following observations:

  • When I install the plugin into foreman and start the app, it says my assets are outside of the foreman namespace and will be ignored.
  • Assets with the same name will not be overriden. I suspect fingerprinting to contribute to this.
  • Assets can be seen, but they aren’t at the correct path. [localhost:3000/assets/logo.png](http://localhost:3000/assets/logo.png) will point to the foreman logo, but /assets/images/logo.png will point to the logo from my plugin.

I’ve also tried using /public and /vendor folders to no avail. I haven’t even tried overriding webpack yet.

1 Like

Can you describe a bit more what you intend to do? We did drop support for filename replacement, but there are other tools that you can use to reskin foreman. Let’s see if we can find a good solution to your needs.

Mainly, we want to change basic things like certain colors and the logos to better match our own branding.

I would suggest adding a plugin with a custom css file.

In the css file use the most specific rules you can, so those rules would be applied.
Then you can use deface to add the css tag to the bottom of the <head> tag. This will make sure that if the rule is as specific as the one in Foreman, your one will take precedence.

Thanks! I’ll try this out and let you know how it goes.

1 Like

If you will be able to share the code, I could actually help with reviews e.t.c.

I appreciate that! I will ping you as soon as I have something for you to review.

could you solve the error Can't find entry point 'my_plugin_name' in webpack manifest ?, the same is happening to me.