使用 Bower 依赖项将网站部署到 azure [英] Deploy website to azure with bower dependencies

查看:22
本文介绍了使用 Bower 依赖项将网站部署到 azure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASPNET mvc 项目,使用 Nuget 和 Bower 作为依赖项.现在,我需要触发 bower 以在部署时安装组件,或者通过允许它们在我的 .gitignore 中包含这些包作为后备.当然,我不希望将它们包含在 repo 中,而只是在部署时安装它们,就像使用 nuget 包一样.我尝试遵循本指南 http://gregtrowbridge.com/deploying-a-bower-dependent-node-app-on-windows-azure/ 但似乎仍然没有发生任何事情.所以欢迎任何帮助:)

I have an ASPNET mvc project using both Nuget and Bower for dependencies. Now I need to either trigger bower to install components upon deployment or as fallback include the packages by allowing them in my .gitignore. Of course I would like to not include those in the repo and just have them installed while deploying, just like with nuget packages. I tried to follow this guide http://gregtrowbridge.com/deploying-a-bower-dependent-node-app-on-windows-azure/ but still nothing seems to happen. So any help is welcome :)

最好的问候

推荐答案

所有 Azure 网站工作人员都预装了 bower,应该就在您的路上.

All of Azure Websites workers have bower pre-installed and should be on your path.

您需要做的就是添加一个自定义部署脚本来执行bower install以下是使用 bower 的 ASP.NET MVC 站点的示例存储库

All you need to do is add a custom deployment script that would do bower install Here is a sample repo for an ASP.NET MVC site that uses bower

基本上确保 bower.json 存在并且在您的csproj

Basically make sure bower.json is there and referenced in your csproj

    <Content Include="bower.json" />

然后下载您的自定义部署脚本.如果你去 https://.scm.azurewebsites.net 然后点击 Tools ->下载自定义部署脚本 或直接从 D:homedeployment ools 下载,然后在 repo like here 基本上会有 2 个文件 deploy.cmd.deployment

Then download your custom deployment script. if you go to https://<yourSiteName>.scm.azurewebsites.net then click on Tools -> Download custom deployment script or just download it from D:homedeployment ools then check it in the root of your repo like here basically there will be 2 files deploy.cmd and .deployment

这是部署逻辑,在其中添加一个步骤来恢复 bower 像这里走到那里

this is the deployment logic, add a step to restore bower in it like here after the last step there

:: 4. Bower Install
if EXIST "%DEPLOYMENT_TARGET%ower.json" (
    pushd "%DEPLOYMENT_TARGET%"
    call :ExecuteCmd bower install
    IF !ERRORLEVEL! NEQ 0 goto error
    popd
)

这篇关于使用 Bower 依赖项将网站部署到 azure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆