如何将现有的 NativeScript Angular 项目转换为代码共享项目 [英] How to convert existing NativeScript Angular project to Code Sharing project

本文介绍了如何将现有的 NativeScript Angular 项目转换为代码共享项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有可用的教程都讨论将 Angular Web Apps 转换为代码共享 Nativescript 项目.我想做相反的事情.

All available tutorials talk about converting Angular Web Apps to codesharing Nativescript projects. I want to do the opposite.

我几乎用 Nativescript 完成了移动应用程序的编码,现在我想制作一个在两者之间共享代码的 Web 应用程序.

I almost finished coding the mobile app with Nativescript and now I wanna make the Web App with the code sharing in between both.

推荐答案

几天前我做了几乎相同的事情,虽然不完全标准,但我的方法是:

I did almost the same a couple of days ago, and while not exactly standard, my approach has been:

  • 从头开始创建一个新的共享网络/移动项目.
  • 将 Angular 组件从仅限移动设备的项目移动到共享项目.
  • 将所有 HTML 文件重命名为 .tns.html(也许你也应该重命名 SCSS/CSS 文件,我没有)
  • 为您添加的每个组件创建空的 HTML 文件
  • 调整 app.module.tsapp.module.tns.ts 以包含新组件和任何服务.app.module.tns.ts 应该非常类似于移动端应用之一.
  • 构建并解决出现的错误.如果可能,请保留用于移动和网络构建的 webpack 监视文件,以便您可以解决两个平台的错误.
  • create a new shared web/mobile project from scratch.
  • move angular components from the mobile-only project to the shared project.
  • rename all HTML files to .tns.html ( probably you should rename SCSS/CSS files too, I didn't have any)
  • create empty HTML files for each component you have added
  • adapt app.module.ts and app.module.tns.ts to include the new components and any service. app.module.tns.ts should very closely resemble the one of the mobile-only app.
  • build and resolve errors when they appear. If possible, keep webpack watch files for both mobile and web build, so that you can resolve errors for both platforms.

这篇关于如何将现有的 NativeScript Angular 项目转换为代码共享项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆