简体   繁体   English

如何在生产中构建yeoman“角度生成器”应用程序?

[英]How to build the yeoman “angular-generator” app in production?

I created my angular application with "yeoman" using "yo angular" with grunt sass bootstrap. 我使用带有咕angular的无聊引导程序的“ yo angular”和“ yeoman”创建了我的angular应用程序。

But with node_mudules bower_component and all dev feature the empty project is 200mo sized 但是使用node_mudules bower_component和所有开发人员功能,空项目的大小为200mo

How can I build my application for production, include minify css/js and keep only used and required dependance. 如何构建用于生产的应用程序,包括缩小css / js并仅保留已使用和必需的依赖项。

EDIT 编辑

I don't understand the -1, thousand people use the angular-generator from yeoman and I can't find a build tutorial for this specific generator. 我不了解-1,成千上万的人使用了yeoman的angular-generator,我找不到该特定生成器的构建教程

grunt build seems to work but the website is not displaying well. grunt build似乎可以正常运行,但网站显示不佳。

grunt serve:dist build and run on serve but same problem as grunt build grunt serve:dist构建并在服务上运行,但与grunt build相同的问题

The dev application ( it s just yo angular empty project ) 开发应用程序(这只是您的有yo angular空项目)

After grunt serve , it works and i can navigate grunt serve后,它可以工作了,我可以导航

在此处输入图片说明

After grunt serve:dist , it doesn't work and i can't navigate, it seems like "bower_components" are not build well grunt serve:dist ,它不起作用并且我无法导航,似乎“ bower_components”的构建不正确

在此处输入图片说明

if you are using grunt do: "grunt build" or "grunt serve:dist", after the build you will get a dist folder, everything inside is you production app included minify css/js, you don't need anymore. 如果您使用grunt做:“ grunt build”或“ grunt serve:dist”,则在生成之后,您将获得一个dist文件夹,其中包含生产应用程序的所有内容都将css / js缩小,您不再需要了。 And specify that for unknow reason "yo angular" add jquery to "devDependencies" but not in "dependencies" in bower.json in you project. 并指定出于未知原因,“ yo angular”在项目的bower.json中将jquery添加到“ devDependencies”,而不是“ dependencies”。

You do not need to deploy everything from your project folder. 您不需要从项目文件夹中部署所有内容。 Hope it help. 希望对您有所帮助。

You do not need to deploy everything from your project folder. 您不需要从项目文件夹中部署所有内容。 You can find info on this page . 您可以在此页面上找到信息。

Only files which you include/import in your index.html or css ( images or fonts ), are being used and tracked. 仅使用和跟踪您在index.html或css中包含/导入的文件(图像或字体)。 Rest are all useless after deployment. 部署后,其余的一切都无用。

run gulp --production. 运行gulp --production。 firts it will clean dist folder (if exist) then move the minified and uglified file there. 首先将清理dist文件夹(如果存在),然后将缩小和丑化的文件移动到那里。

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

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