I am using Eclipse IDE for PHP and now that I started using also JS I am missing the autocomplete options. I do not know if they're missing because I did something wrong or because the variables are not defined yet (similiar to MATLAB). Autocomplete works great with PHP, HTML and CSS but not with JS.
I tried the classic
> Window > Preferences > JavaScript > Editor > Content Assist > Advanced
and
Installing extensions
but it did not help. I also tried to reference to some external files, but I am pretty sure that's not what is wrong.
I've been searching the whole day and I did not find an actual answer. As Eclipse has so many multiple options to adjust everything, I am getting a bit overwhelmed with that...
I would appreciate someone explaining to me how the autocompletion works. Where and whwn does it look for the suggestions (definitions in the js file or in the whole script) and why does it not show the DOM methods like window.onload or document.getElementById for example. Is this normal because there is no window/document yet or do I have to check some checkboxes in order to make eclipse do that?
The best content assist (and validation and more) for JavaScript and all dynamic web languages is available in the CodeMix plugin for Eclipse.
Here's a specific comparison between Eclipse JSDT and CodeMix.
You can install CodeMix from the Eclipse Marketplace here.
Hope that helps!
I recently ran into the problem related to html document validation. It seems to me that Chrome is pretty clever and can fix most of the mistakes.
In my case I receive raw html file with mistakes and I need to load it on Sumsung TV powered by Tizen 2.4. Unfortunately it doesn't provide the same features as Chrome so I need to fix documents by myself.
What do you think about html validation with help of javascript (My app is written in js).
Download html page and save it
1.2. Download all the related files (css,js,images) and fix links
fix all the problems (use some library, or may be there are some
good validators, but it is better to do offline)
Open document
You can use a linter; a quick search on Github showed up some JavaScript-powered HTML-linters:
htmllint: for HTML5
Bootling: for Bootstrap
Just wondering if it's possible really. I have a large website, with hundreds of JS and HTML files.
Is it possible to compile these down into a single DLL, so when deployed to customers web servers they don't see or have access to the code?
I have never tried, but theoretically it is possible to achieve that.
HTML - compile (I assume you use *.cshtml)
Set <MvcBuildViews>true</MvcBuildViews> in the <PropertyGroup> element of your .csproj file.
JS, you will have to ember js files as resources, use ScriptManager to load it
CSS - hack it, with same methods as js, but using Add CSS File in DLL (Class Library)
Even if you minify, obfuscate, compile and ship it as dll, I will be able to see html/css/js with developer tools. And honestly none of it make sense, horrible debugging, no caching.
you actually can,
ember your js and css files (view remigijus answer).
When you publish,
in the configure part of the settings tab (see capture below), be sure to uncheck
"allow precompiled site to be updatable" <--- will compile the cshtml
"chose merge page and control in a single assembly"
but i raise the same warnings than your other answers, it's useless and counterproductive. Keep in mind that anyone can decompile a .net assembly anyway
While modifing my eclipse juno 4.2 with some WebDev-Features, I am currently stuck while adding library support for JQuery, JQMobi and other.
This is my situation:
(source: codespot.com)
This would be my goal:
The Problem
Is it only possible to manipulate the build-in JS-Libraries of Eclipse through plugins or manually too?
Because, when I click on Add JavaScript library, I don't get this:
In my case, there is only User Library - how can I add other ones?!
These links were kind of helpful, but don't show a solution to my problem:
https://stackoverflow.com/a/12892508/1370465
http://www.ibm.com/developerworks/library/os-eclipse-jsdt/
http://marketplace.eclipse.org/content/jsdt-jquery#.UVB0clfAm2U
A user library represent sets of JavaScript files chosen by a user and preset through the User Libraries preference page.
Everything else is provided by plug-ins.
I am not even sure if something like I want is possible, so I am asking you guys to just let me know if anyone did that before. So, my goal is to when I click on "Publish" website in VS2010, to have all javascript files compressed into one, same with css and then in my layout file change the references from all different js and css files to only those two merged ones. Is that doable? Or maybe it's doable but in more manual way?
Of course the goal here is to have only two calls to external files on the website, but when I develop I need to see all files so that I can actually work with it. I guess I could do it manually before each push, but I'd rather have it done automatically using some script or something. I didn't try anything yet, and I am not looking for ready solution, I am just looking to get to know the problem better and maybe some tips.
Thanks a lot!
This is built into ASP.net 4.5. But in the mean time, you should look at the following projects
YUI Compressor
The objective of this project is to compress any Javascript and Cascading Style Sheets to an efficient level that works exactly as the original source, before it was minified.
Cassette
Cassette automatically sorts, concatenates, minifies, caches and versions all your JavaScript, CoffeeScript, CSS, LESS and HTML templates.
RequestReduce
Super Simple Auto Spriting, Minification and Bundling solution
No need to tell RequestReduce where your resources are
Your CSS and Javascript can be anywhere - even on an external host
RequestReduce finds them at runtime automatically
SquishIt
SquishIt lets you squish some JavaScript and CSS. And also some LESS and CoffeeScript.
Combres
.NET library which enables minification, compression, combination, and caching of JavaScript and CSS resources for ASP.NET and ASP.NET MVC web applications. Simply put, it helps your applications rank better with YSlow and PageSpeed.
Chirpy
Mashes, minifies, and validates your javascript, stylesheet, and dotless files. Chirpy can also auto-update T4MVC and other T4 templates.
Scott Hanselman wrote a good overview blog post about this topic a while back.
I voted up the answer that mentioned Cassette but I'll detail that particular choice a little more. Cassette is pretty configurable, but under the most common option, it allows you to reference CSS and Javascript resources through syntax like this:
Bundles.Reference("Scripts/aFolderOfScriptsThatNeedsToLoadFirst", "first");
Bundles.Reference("Scripts/aFolderOfScripts");
Bundles.Reference("Styles/aFolderOfStyles");
You would then render these in your master or layout pages like this:
#Bundles.RenderStylesheets()
#Bundles.RenderScripts("first")
#Bundles.RenderScripts()
During development, your scripts and styles will be included as individual files, and Cassette will try to help you out by detecting changes and trying to make the browser reload those files. This approach is great for debugging into libraries like knockout when they're doing something you don't expect. And, the best part, when you launch the site, you just change the web.config and Cassette will minify and bundle all your files into as few bundles as possible.
You can find more detail in their documentation (which is pretty good though sometimes lags behind development): http://getcassette.net/documentation/getting-started
Have a look at YUI compressor # codeplex.com this could be really helpful.
What I have done before is setup a post-build event, have it run a simple batch file which minimizes your source files. Then if you're in release mode (not in debug mode), you would reference the minimized source files. http://www.west-wind.com/weblog/posts/2007/Jan/19/Detecting-ASPNET-Debug-mode
I haven't heard about publish minification. I think use should choose between dynamical minification like SquishIt or compile time like YuiCompressor or AjaxMinifier.
I prefer compile time. I don't think it's very critical to have to compile time changing files. If you have huge css/js code lines you can choose this action only for release compilation and if it helps publish this files only in needed build cinfigurations.
I don't know if there is any possible way to somehow hook into the functionality from that 'Publish' button/whatever it is, but it's surely possible to have that kind of 'static build process'.
Personally I'm using Apache ANT to script exactly what you've described there. So you're developing on your uncompressed js/html/css files and when you're done, you call like ant build which then minifies, compresses, stripes and publishes your whole web application.
Example script: https://github.com/jAndreas/typeof-NaN-2.0/blob/master/build/build.xml