Git Product home page Git Product logo

jasonzhoush / nicefish Goto Github PK

View Code? Open in Web Editor NEW

This project forked from damoqiongqiu/nicefish

0.0 2.0 0.0 15.02 MB

NiceFish(美人鱼)是一个系列项目,全面演示了Angular最新版本的各种用法,从桌面端到移动端都有demo,来抄啊!

Home Page: http://git.oschina.net/mumu-osc/NiceFish

License: MIT License

TypeScript 31.39% JavaScript 0.92% HTML 14.57% CSS 53.12%

nicefish's Introduction

nicefish-jigsaw

NiceFish(美人鱼)

谢谢大家,过了1000个星儿了,我可以拿到一个开源奖杯了 :)

既然求星儿是有效的,那就继续求星儿、求捐助。

NiceFish是一个系列项目,都是Angular这个技术栈。

对应的视频教程

此项目对应的视频教程(超清),包括所有PPT,请点这里:http://damoqiongqiu.github.io/videos/index.html

用法

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

npm i -g cnpm
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
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://my.oschina.net/mumu/blog/830696

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

如何更新NiceFish的代码

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

git pull
cnpm update
ng serve

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

AOT&TreeShaking

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

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

ng build --prod

加上--prod参数之后,angular-cli会自动启用TreeShaking(摇树)特性,简而言之,就是把用不到的包全部剔除掉,就像从树上把枯叶子摇下来一样,很形象吧?

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

关于Tomcat如何启动gzip,我专门写了一篇文章来介绍配置,请点这里:https://my.oschina.net/mumu/blog/830742

【请注意】最新版本的@angular/cli已经内置了对AOT和TreeShaking的支持,只要像上面这样在build的时候加上--prod参数就可以了,不需要再做任何其它任何配置工作,中文网站上的那一篇指南过时了。

推荐项目

在线交流QQ群

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

Angular-2区-敦煌:139357161(满)

Angular-3区-玉门关:473129930(满)

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

Angular-5区-楼兰:483016484(将满)

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

关于我

我是大漠穷秋,我的Github个人主页在这里:http://damoqiongqiu.github.io/

如果您觉得看视频教程不过瘾,想要找我去现场讲,请联系我的微信scriptbaby。当然,现场版的演讲会比线上内容更详细,而且可以带着大家实际上手写一些代码。

注意,微信号只谈公事,不聊天儿,也不答技术问题。不要腆着个脸把那些很二的问题随便甩过来,有一个网站叫百度,你知道的!

开源许可证

MIT

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

nicefish's People

Contributors

damoqiongqiu avatar

Watchers

 avatar  avatar

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.