Created
June 14, 2017 09:07
-
-
Save EddyVerbruggen/e1e39f35294dd897d163b605f6659e43 to your computer and use it in GitHub Desktop.
Global tablet CSS for NativeScript apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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