I am building a Liferay Angular portlet that uses angular material inputs and some inputs are not rendering well at all. I am guessing that some CSS/JS is missing, but I can not figure it out what exactly.
My styling css file looks like this:
@import "~@angular/material/prebuilt-themes/deeppurple-amber";
Also, when I inspect with Developer tools, I see the following warning:
Could not find Angular Material core theme. Most Material components may not work as expected.
I have also tried referencing the css file from the AppComponent with styleUrls: ["/o/<my-portlet_name>/lib/app/styling.css"], but without any luck.
So, my question is - How to reference a CSS file within an Angular Portlet in Liferay ?
I have read over and over again this article and finally I made the following changes:
styling.css
file into styling.scss
@import "../../../../../node_modules/@angular/material/prebuilt-themes/deeppurple-amber";
- I am not sure why are necessary 5 of ../
, I was expecting that by using ~
to know where node_modules
folder isproperty
attribute of the @Component
annotation in my Portlet: "com.liferay.portlet.header-portlet-css=/lib/app/styling.css"
- yes, the extension is .css
and not .scss