Visual Studio intellisense for Bootstrap via CDN

大兔子大兔子 提交于 2019-11-30 06:44:43

You can add CDN references to intelliSence for javascript, however, css is not supported.

You can add the file to your project and it will work, you dont need to add a ref to html, just to project and it should resolve your issue.

If you are working with ASP.NET Core project do as follows. VS only reference files inside the wwwroot folder. You need to open the .csproj file and add the following code segment.

<ItemGroup>
  <None Include="node_modules/**" />
</ItemGroup>

After that VS will picking up intellicen from node_modules.

You need to install bootstrap through the NuGet Packages. Intellisense will start working after that.

vibs2006

Open Visual Studio

Go in Extensions and Updates and then click on Online Tab.

In Search type Bootstrap.

Install following Packs to enable intellisense. Ensure that you have dragged bootstrap.css (or bootstrap.min.css and js file) before trying to insert snippet.

  • Bootstrap Bundle
  • Bootstrap Snippet Pack

TOOLS->Options->Text Editor->the specific language ->IntelliSense

That should get the intellisense back up and running, worked for me before (think this is what you are looking for)

Divi perdomo

I know this way is not exactly CDN, but it worked for me and you can still keep your packages up-to-date

You can reference Bootstrap using Bower.

On the package.json you would have:

{
  "version": "1.0.0",
  "name": "TaskAngularJSApp",
  "private": true,
  "devDependencies": {
    "grunt": "0.4.5",
    "grunt-contrib-uglify": "0.7.0",
    "grunt-contrib-watch": "0.6.1",
    "bower": "1.7.3"
  }
}

Then you have bower.json file like:

{
    "name": "ASP.NET",
    "private": true,
    "dependencies": {
        "bootstrap": "*"
    }
}

Then on your html you would reference bootstrap like

    <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css" />
    <script src="/lib/bootstrap/dist/js/bootstrap.min.js"></script>

I got help from: using grunt bower gulp npm with visual studio 2015 for a asp-net-4-5-project

and

Released Today: Visual Studio 2015, ASP.NET 4.6, ASP.NET 5 & EF 7 Previews - On the "HTML Editor Updates" section

In the Content folder copy bootstrap.css.

I just installed the bootstrap nuget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!