How to load css files based on platform


#1

Hi there, I am trying to load CSS files using the method addCssFile available in the Page class, this is what I do in the Constructor:

this._page.addCssFile((this.isTablet) ? "~/assets/tablet.css" : "~/assets/phone.css");
this._page.addCssFile((this.isTablet) ? "~/pages/dashboard/dashboard.component.phone.css" : "~/pages/dashboard/dashboard.component.phone.css");

I also tried:

this._page.addCssFile((this.isTablet) ? "../../assets/tablet.css" : "../../assets/phone.css");
this._page.addCssFile((this.isTablet) ? "./login.component.tablet.css" : "./login.component.phone.css");

but no luck :frowning: .

Any suggestions?

Thanks!


#2

Try this plugin