Dear Ivy team.

I just wanna ask you that is there any possibility to override CSS from child module to parent module.

For example, we are having 2 ivy projects: project Parent and project Child, Child depends on Parent and both of them are deployed in the same application.

We need to change some style for both of them but the problem is we don't have right to modify project Parent. So in project Child, we defined some custom CSS styles and import it in XHTML page. This way works well for only views that belong to Child project, but with the view in Parent project, it can't work because we can't inject our CSS to Parent project.

Our attempt was creating a custom theme as this suggestion: https://answers.axonivy.com/questions/12/how-to-create-my-own-theme-for-html-user-dialogs and put this jar file under Designer/Engine folder. The way just works perfectly, our custom CSS style can apply for both Parent and Child. But the small problem is whenever we change our style, we need to build the jar and put it in Designer/Engine manually, it's really not convenient.

So to overcome this inconvenience, we try to put our custom theme in project Child with the same structure of custom PrimeFaces theme like this: alt text

With this way still only work for Child project, not Parent project because when we start a view in Parent project, we got a problem: FacesException: Error loading css, cannot find "theme.css" resource of "primefaces-serenity-bluegrey" library

that error comes from org.primefaces.renderkit.HeadRenderer alt text

After debugging, I figure out that Ivy also takes part in the resource loading process: alt text

Unfortunately, we can't see what inside that class and don't know is there any possibility to inject our custom CSS into that process. I know that inject CSS from child to parent is something weird but actually, we can't find an alternative way.

So I just wanna ask you that is there any possibility to inject CSS from child to parent?

Thank in advance!

asked 05.04 at 07:34

lphieu's gravatar image

lphieu
215
accept rate: 0%

edited 05.04 at 07:42


Hi lphieu

No, there is no way a project can access a css file from another project. They are capsulated and have no rights to access files outside. The only way to override a theme for a project where you have nor access rights, is like you described it above. Create a custom theme, pack it as a jar archive and put it into the webapps/ivy/resources/WEB-INF/lib folder of the engine/designer. As the error message says it: cannot find "theme.css" resource of "primefaces-serenity-bluegrey" library. The folder "primefaces-serenity-bluegrey" is no library (jar).

Sorry that there is no easier way for your problem. But why do you want to modify the style of a project you don't have access to modify?

Kind regards,

Lukas

link

answered 05.04 at 08:54

Lukas%20Lieb's gravatar image

Lukas Lieb ♦♦
18618
accept rate: 66%

Awesome, it seems that the only way we can do is using our custom theme. For the reason why we want to modify a project we don't have the right to access because we're using Ivy's Portal. We want to use the pristine version of Portal as well as apply our custom style to it. Thank so much for your clarification.

(08.04 at 21:53) lphieu lphieu's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4
×2

Asked: 05.04 at 07:34

Seen: 73 times

Last updated: 08.04 at 21:53