Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EddyVerbruggen/e1e39f35294dd897d163b605f6659e43 to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/e1e39f35294dd897d163b605f6659e43 to your computer and use it in GitHub Desktop.
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