I have a website that I am using Grunt to concat files. I am wondering if there is currently some way to reference my Bower packages in all of my JS files as I use those packages within my files.
Example: I include 'moment' as a Bower package and then when I reference 'moment' in my JS file within VS Code I get a warning that 'moment' does not exist. This is annoying because I know it exists globally and would like to be able to manually reference it for code completion (and to get rid of the warning).
VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term.
The Find All References command is available on the context (right-click) menu of the element you want to find references to. Or, if you are a keyboard user, press Shift + F12.
To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.
You can omit the warning by adding the following to the top of your sources:
/*global moment*/
You can also create a globals.js
file, add all those global definitions to it and reference it from your sources like this:
/// <reference path="global.js" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With