简体   繁体   English

如何在Visual Studio中使用Bower安装jQuery qTip2?

[英]How to install jQuery qTip2 using Bower in Visual Studio?

I just recently started using Bower/Grunt to manage my client-side dependencies for my ASP.net MVC application. 我最近才开始使用Bower / Grunt来管理ASP.net MVC应用程序的客户端依赖项。 Every package I've ever used contains a JavaScript source file, until I tried to use the jQuery qTip2 package. 在我尝试使用jQuery qTip2软件包之前,我曾经使用过的每个软件包都包含一个JavaScript源文件。

I thought maybe since it included a gruntfile I could build it using the Task Runner in Visual Studio 2015 but the Task Runner doesn't seem to know the file is there, even if I include it in the project. 我想也许是因为它包含一个gruntfile,所以我可以使用Visual Studio 2015中的Task Runner来构建它,但是Task Runner似乎不知道文件在那里,即使我将其包含在项目中也是如此。

Does anyone have experience using Bower/Grunt with qTip2 in Visual Studio? 有没有人有在Visual Studio中将Bower / Grunt与qTip2结合使用的经验? How do you typically use a bower component if it is missing the final script and css files? 如果缺少最终脚本和CSS文件,通常如何使用Bower组件?

If you checked qTip2 repository on github you will find that it doesn't have a bower.json file. 如果您在github上检查了qTip2存储库,您会发现它没有bower.json文件。 This files contain the necessary information for grunt-wiredep to work with. 该文件包含grunt-wiredep可以使用的必要信息。

You can install it from its git url using 您可以使用以下命令从其git URL安装它

bower install --save https://github.com/qTip2/qTip2.git

This will install qTip2 and add it to your bower.json file. 这将安装qTip2并将其添加到您的bower.json文件中。 Now you need to define which files you need to include by providing an override in your bower.json like this: 现在,您需要通过在bower.json中提供覆盖来定义需要包含的文件,如下所示:

"overrides":{
    "package-name": {
      "main": [
        "path-to-js-file",
        "path-to-css-file"
      ]
    }
  }

You can optain the "pachage-name" from your bower.json after the installation is finished. 您可以从optain了“pachage名” bower.json安装完成后。

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

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