Giter Site home page Giter Site logo

hxsdxu / nicefish Goto Github PK

View Code? Open in Web Editor NEW

This project forked from damoqiongqiu/nicefish

0.0 1.0 0.0 15.5 MB

NiceFish(美人鱼)是一个系列教学项目,全面示范了Angular在浏览器、移动端、Electron环境中的用法。

Home Page: http://www.ngfans.net

License: MIT License

TypeScript 30.68% JavaScript 0.85% HTML 18.00% CSS 50.47%

nicefish's Introduction

nicefish

NiceFish(美人鱼)

NiceFish 是一个系列教学项目,目标是全面示范 Angular 在浏览器、移动端、Electron 环境中的用法。

产品代码

OpenWMS 是一个开源产品,复杂度比 NiceFish 高,请不要用此项目进行入门学习。

在线演示

NiceFish: http://47.104.13.149:4200

NiceFish-Admin: http://47.104.13.149:8080

OpenWMS:http://47.104.80.251:4200

NiceFish-ionic:https://damoqiongqiu.github.io/NiceFish-ionic/

用法

用 git 克隆本项目,从命令行进入进入项目根目录,依次执行以下命令:

npm i -g cnpm --registry=https://registry.npm.taobao.org
cnpm i -g @angular/cli
cnpm install
ng serve
  • 如果之前装过@angular/cli 需要先卸载:npm uninstall -g @angular/cli
  • 如果之前装过 angular-cli 需要先卸载:npm uninstall -g angular-cli
  • 如果你之前已经尝试安装过 node 模块,请把 NiceFish 根目录下的 node_moduels 目录删掉

然后依次执行以下命令:

npm cache clean
npm prune
npm i -g cnpm --registry=https://registry.npm.taobao.org
cnpm i -g @angular/cli
cnpm install
ng serve

打开你的浏览器,访问http://localhost:4200/

如果你想让加载的包更小,请使用以下方式启动@angular/cli 内置的轻量级 http server

ng serve --prod

如果你需要把项目发布到其它类型的 Server 上,例如 Tomcat,需要对 Server 进行一些简单的配置才能支持 HTML5 下的 PushState 路由模式,请从以下链接里面查找对应的配置方式:https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions ,在 How to: Configure your server to work with html5Mode 这个小节里面把常见的 WEB 容器的配置方式都列举出来了,包括:IIS、Apache、nginx、NodeJS、Tomcat 全部都有,你过去抄过来就行。

【注意】如果你发现 ng serve 起不来,或者起来有报错,请把 NiceFish 根目录下的 node_modules 目录删掉,然后重新执行 cnpm install,全局的@angular/cli 也需要删掉重装。

如何更新 NiceFish 的代码

打开命令行,进入 NiceFish 根目录,依次执行以下命令:

git pull
cnpm update
ng serve

噢对,如果你 pull 代码之后发现起不来了,请把你项目下的 node_modules 全部删掉,然后重新 cnpm update。这里确实有点坑,但是我也不知道为什么,目测是 npm 包的版本问题。

TreeShaking

开发状态打出来的 bundle 体积比较大,在发布到生产环境之前需要进行 TreeShaking,用法如下:

打开命令行,进入 NiceFish 根目录,执行以下命令: ng build --prod

加上 prod 参数之后,@angular/cli 会利用 envionments/envionments.prod.js 里面的配置项来构建项目,同时会自动启用 TreeShaking(摇树)特性,简而言之,就是把用不到的包全部剔除掉,就像从树上把枯叶子摇下来一样,很形象吧?

@angular/cli 会在项目根目录下生成一个 dist 目录,里面就是编译、压缩好的文件了。仔细观察你会发现,这些文件的体积已经被大幅度压缩,加上 gzip 之后有一些文件只剩下 1/4 左右的大小。

在线交流 QQ 群

Angular-1 区-丝绸之路(满)

Angular-2 区-敦煌(满)

Angular-3 区-玉门关(满)

Angular-4 区-河西走廊(满)

Angular-5 区-楼兰(将满)

Angular-6 区-凉州(将满)

脚本娃娃-桃花岛(将满)

如果您有 Angular 相关的问题需要讨论,或者单纯想跟我 Say Hello,请加上面几个扣扣群。注意,我每天都会收到大量的求助消息,真的有点忙,所以请您优先在扣扣群里面讨论问题。

学习资源和视频教程

大漠演讲中的所有 PPT 已经本项目对应的资料都在这里,您可以随意使用,https://gitee.com/mumu-osc/NiceFish/attach_files

如果您需要教程,请自己来这里查看,http://www.ngfans.net/ ,有视频也有文字,有免费版本也有收费版,您自己看着选。

开源许可证

MIT

你可以随意使用此项目,无需通知我,因为我可能很忙没空搭理你。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.