GithubHelp home page GithubHelp logo

guoyu07 / nicefish Goto Github PK

View Code? Open in Web Editor NEW

This project forked from damoqiongqiu/nicefish

0.0 0.0 0.0 15.42 MB

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

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

License: MIT License

TypeScript 30.00% JavaScript 0.86% HTML 18.07% CSS 51.07%

nicefish's Introduction

nicefish-jigsaw

NiceFish(美人鱼)

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

在线演示

NiceFish: http://47.104.13.149:4200

NiceFish-Admin: http://47.104.13.149:8080

OpenWMS:http://47.104.80.251:4200

(比较穷,买了一个阿里云小主机,您担待。)

用法

用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

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

nicefish's People

Contributors

damoqiongqiu avatar zhongzhong0505 avatar chenglongzjg avatar lostlover avatar yozman avatar tangfang 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.