I have a custom javascript file for my project. But I have read that we should always use minified version because it's efficient. So everytime I make a change in my Custom.js file, I go to online tool convert my New custom.js file and delete my old Minified Custom JS file from my project and replace it with new one(minified one). Is there any good way to handle this situation. Kindly note that in no where in my project I am referring to the actual Custom.Js file. I have added only the reference to the Minified version.
IDE: Visual Studio Community Edition Free
(2017)
Bundling and Minification is a default feature from MVC4. you just need to be implement in your bundle config file.
BundleTable.EnableOptimizations = true;
Detailed document here. please follow.
You can try use a plugin for your IDE :)
Then you save your file it will automaticaly save one .min its possible for CSS too. Which IDE are you using?
I have a MVC project with several JavaScript script files. Some of these files need to be unit-tested. For that, we have a separate JS file. The test file is placed in the Scripts folder and is not included in the project (i.e. no reference in the .csproj file). All our script files are referenced in _references.js.
The test file, when opened from Visual Studio, does not have any IntelliSense support for the files include in the project; there is nor jQuery support, nor custom scripts support. Please note that Vanilla JS IntelliSense works.
Is there a way of enabling IntelliSense support from the files references in _reference.js, for JavaScript files that are not included in the project?
According to Mads Kristensen
There are several ways of implementing Intellisense for JavaScript. The three I remember being discussed were:
1. All .js files in the project are automatically included in Intellisense
2. Only .js files included on the same HTML pages are included
3. The user can manually reference other .js files
The solution then was to add _references.js as a specific reference at the begining of the file not included in the project.
/// <reference path="_references.js" />
//other JS code
This enables IntelliSense support for the _references.js file, which in turn enables IntelliSense for the files it references.
I want to work with Senach Ext Js in a Website project in VisualStudio 2013.
The problem: VisualStudio respectively WebEssentials throws warnings like:
JsHint (W117): 'Ext' is not defined.
Here is the situation as it looks today:
The project is exactly what Sencha Cmd produced for me.
At the moment I want only a Website project and no server sided code involved (therefore I did not make a MVC or Web API project).
I know that there is a way to define some global symbols in each JavaScript file for JsHint, but I want to get the intellisense working too. So I am looking for the correct configuration for both use cases: WebEssential JSHint Warnings and Intellisense.
Maybe both problems need to be addressed separately. That would be fine too.
Is my directory structure correct (just took what Sencha Cmd built for me)?
How to address the problem to make intellisense working?
(How to avoid Webessential JavaScript warnings (it seems most or all of them are JsHint)?)
Update: Related question:
Enabling JSHint Support for Ext.js in Intellij Idea
Update:
"An _references.js file in any other location than
“~/Scripts/_references.js” will be just like any other JS file and
won’t be used for global intellisense. Even putting the file in the
root of your web project will not work as well."
Source: http://gurustop.net/blog/2012/03/03/javascript-js-intellisense-auto_complete-in-visual-studio-11-beta-the-web-_references-js-file/
still not working when I have the _references in a new "Script" folder:
So it seems like the final answer was to add a file called ~/scripts/_reference.js and then include a line to reference Ext JS in there. This enables Visual Studio to index the Ext JS source for Intellisense. For example:
/// <reference path="../ext/ext-all-debug-full.js" />
More on the Intellisense and _reference.js:
http://msdn.microsoft.com/en-us/library/bb385682.aspx
Note that due to the size of the Ext JS codebase, Visual Studio might take a few minutes to complete the indexing process and for Intellisense to start working smoothly.
My Visual Studio project has Typescript files. We keep the Typescript files under version control but not the generated Javascript files. The problem is that whenever I change a Typescript file, the Javascript files get added to my solution. It's annoying because I have to manually remove them from the project before checking stuff in. Is there any way to stop this from happening?
Upgrading to the latest version of the TypeScript plugin will easily solve your problem. There have been a LOT of changes since that version. But, for one, the default functionality is to NOT add the js files to the solution.
I have Visual Studio 2012 installed on my laptop and desktop. On my desktop PC, the JavaScript intellisense is not working. For any method it pulls up (even standard JavaScript calls) I receive the message, "Intellisense was unable to determine an accurate completion list for this expression".
I've tried all of the suggestions from the other posts and tried everything I could find on Google. Nothing has worked. It isn't about not having JQuery Intellisense. I don't get even basic JavaScript Intellisense.
Edit:
The objects in the above images are simple strings, yet I don't get any help from the Intellisense.
I had the same problem: in Visual Studio 2010 I was used to add a reference in my javascript files, at the top, like this:
/// <reference path="/scripts/jquery-1.7.1-vsdoc.js" />
With the new Visual Studio 2012 this was not working anymore, I looked around and found the solution to put the reference in /scripts/_references.js I did so, not working.
What I was doing wrong was that I was referencing the vsdoc.js file, or at the moment of writing, nuget downloaded jquery 1.9.1 package, reference to jquery-1.9.1.intellisense.js which is WRONG.
The correct reference (if using the /scripts/_references.js file) is:
/// <reference path="/scripts/jquery-1.9.1.js" />
(NOT the .intellisense.js or the -vsdoc.js file).
For the global solution to work on all your projects: copy all the jquery files (main, minified, map, and intellisense one, to be sure) in C:\Program Files (x86)\Microsoft Visual Studio 11.0\JavaScript\References (adapt the path if you installed Visual Studio 2012 somewhere else) and in Visual Studio, under Tools > Options > Text Editor > Javascript > Intellisense > References > Add a reference to jquery-1.9.1.js (again, NOT the vsdoc or intellisense file, but the main one) as explained in the solution by denas (but it was not clearly said not to point the vsdoc/intellisense file).
Hope this helps.
Many things can cause problems like this, but I usually follow these steps to troubleshoot it.
close visual studio and restart
reboot windows and start visual studio again
have another developer load your project and test it
create a bare bone project and test with all stock javascript references
reset IDE
run VS in safe mode and test your project
uninstall and reinstall vs
I usually resolve most of the VS problems at step 3 or 4, and sometimes 5.
If you've installed VS on anything other than the C Drive this will happen.
In Visual Studio, under Tools > Options > Text Editor > Javascript > Intellisense > References
Add references to the same .js files that exist in the list but pointing to the new path where you have VS installed
eg - G:\Program Files\Microsoft Visual Studio 11.0\JavaScript\References.libhelp.js
There are 5 of them
After this go to Edit> Intellisense > Refresh external references
I fixed the same problem by right-clicking the file in Solution Explorer and choosing Open With and then choosing Web Form Editor if you're editing a Web form or Source Code (Text) Editor if you're editing a JavaScript file.
In visual studio 2012,
Using this solution https://github.com/jmbledsoe/angularjs-visualstudio-intellisense.
Make sure put ng, ngCookies modules into required fields. For example:
var module = angular.module("demo", ['ng','ngCookies']);
An excellent article by Mads Kristensen helped me fix the JavaScript Intellisense issue.
Triple-slash references look like this and can be added to
the top of any .js file or in /scripts/_references.js file
/// <reference path="../app/respond.js" />
REF: http://madskristensen.net/post/the-story-behind-_referencesjs