[Reminder] With Nativescript 7 released, this article is now meaningless.
Sources:
- Nativescript blog source
- Nativescript code sharing documentation
- Migrate from CSS to SCSS stylesheets for an existing Angular application
As of August 28, 2020, standard installation produce an angular 8 application.
The purpose of this article is to generate a functional application with angular 10.
Install NativeScript release candidate
npm i -g nativescript@rc
Generate a hello-world application
nsc create sampleapp –template @nativescript/template-hello-world-ng
use SASS by default
- install node-sass :
npm i --save-dev node-sass
- rename app.css in app.scss
- replace in app.scss :
@import "~@nativescript/theme/css/core.css";
@import "~@nativescript/theme/css/default.css";
by
@import "~@nativescript/theme/core";
@import "~@nativescript/theme/default";
- change in angular.son
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"cli": {
"defaultCollection": "@nativescript/schematics"
},
"projects": {
"hello-world": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "ns",
"schematics": {
"@nativescript/schematics:component": {
"style": "scss"
}
}
}
},
"defaultProject": "hello-world"
}
Add a login page
ng generate component login
ng generate service services/user
ng generate class models/user --type=model
Test your application
nsc run ios –emulator