Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Global tablet CSS for NativeScript apps
import { NgModule } from "@angular/core";
import { DeviceType } from "ui/enums";
import { device } from "platform";
import * as application from "application";
const fs = require("file-system");
@NgModule({
// ..
})
export class AppModule {
constructor() {
if (device.deviceType === DeviceType.Tablet) {
let cssFileName = fs.path.join(fs.knownFolders.currentApp().path, "app.tablet.css");
fs.File.fromPath(cssFileName).readText().then((result: string) => {
application.addCss(result);
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment