4

I have an Angular 2 project based on webpack 2. Bootstrap is installed as npm package and imported in the app, but Visual Studio doesn't give me intellisense when I edit html files by default.

I added (include) node_modules/bootstrap directory for my app and after restart there is intellisense for bootstrap. I don't like this because it's polluting my project, but as a workaround not bad.

Is there another way (better) to enable this?

Update for Shazia, How to include node_modules/ into project and have intellisense for Bootstrap.

I assume you have a node_modules/ directory in your web project directory where the node packages are stored. Open the solution explorer in visual studio and have your solution open which has your web project.

Click on "Show All Files" icon in Solution Explorer at right top corner.

Show All files icon

You will see all files and directories in your web project directory including node_modules directory. Right click on the bootstrap directory under node_modules/ and select "Include In Project". It will be part of your project.

Include In Project function

Once restarted VS you will have Intellisense for bootstrap.

7
  • You can try to install the Bootstrap through right click the project name and choose ‘Manage Nuget Package…’ and search ‘bootstrap’ under Browse tab and install it, then the intellisense should works. Or you can have a look at this similar issue: stackoverflow.com/questions/24296472/… and add CDN references to intellisense for Javascript which under Tools-Options-Text Editor-JavaScript-IntelliSense-References and reference group set as ‘Implicit (Windows)’. Commented Jan 23, 2017 at 9:23
  • Thank you very much for your answer. If I use either one (Nuget or CDN reference) it would be a duplicate because WebPack takes care of bundling and referencing bootstrap. So, it seems I havo to go with including the node package. Commented Jan 23, 2017 at 17:12
  • @SayusiAndo, where to add node package reference for bootstrap intellisense (as a workaround), as I am also facing the same issue. please copy some code Commented Jan 24, 2017 at 4:42
  • @SayusiAndo, you can have a try with use a particular grunt or gulp file to move the bootstrap to a dist folder, take a look at this: stackoverflow.com/questions/26773767/… Commented Jan 24, 2017 at 6:46
  • 2
    @shaziaperween: please, see my question updated. It contains how I enabled intellisense for Bootstrap so far. Commented Jan 24, 2017 at 11:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.