简体   繁体   English

Aurelia仅用于客户端(前端)数据绑定

[英]Aurelia just for client side (front-end) data binding

I just started to learn about Aurelia . 我刚刚开始了解Aurelia But the problem is I'm a PHP developer so I just want to use it in front-end and I don't want to (can't) install node.js on my server or other requirement for back-end. 但是问题是我是一个PHP开发人员,所以我只想在前端使用它,而又不想(不能)在服务器上安装node.js或后端的其他要求。

First, I wanted to use Angular for fetching data from server in JSON then adding it to my page but after reading about Aurelia I decided to use it. 首先,我想使用Angular从JSON从服务器获取数据,然后将其添加到我的页面中,但是在阅读了有关Aurelia我决定使用它。 So how can I use it without any server implementation. 因此,如何在没有任何服务器实现的情况下使用它。

I know that in Aurelia we use TypeScript so we need a transpiler . 我知道在Aurelia我们使用TypeScript所以我们需要一个transpiler how can I convert my code into JS then upload it on server for client to use it? 如何将我的代码转换为JS然后将其上传到服务器上以供客户端使用?

There are ready to use bundles here: https://github.com/aurelia/aurelia 可以在这里使用捆绑软件: https : //github.com/aurelia/aurelia

Copy the src folder, scripts folder and index.html into your project and you'll be up and running. src文件夹, scripts文件夹和index.html复制到您的项目中,即可启动并运行。

This kind of setup would not be suitable for production because the transpilation from TypeScript to JavaScript is happening in the browser (vs ahead of time, as part of your build process). 这种类型的设置不适用于生产环境,因为从TypeScript到JavaScript的转换是在浏览器中进行的(相对于构建过程中的提前)。

A better approach would be to use the aurelia-cli to do your development- this requires node on your development machine only . 更好的方法是使用aurelia-cli进行开发-这仅需要开发计算机上的节点。 When you're ready to deploy copy the contents of the scripts folder and the index.html to your production server. 准备部署时,将scripts文件夹和index.html的内容复制到生产服务器。 Node is not required at runtime. 运行时不需要节点。 The output is static files: html, css and javascript. 输出为静态文件:html,css和javascript。

http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/1 http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM