Grunt errors on javascripts

The following can be seen in your scripts.min.js

jQuery.extend(jQuery.validator.messages,{required:"Campo obbligatorio.",remote:"Controlla questo campo.",email:"Inserisci un indirizzo email valido.",url:"Inserisci un indirizzo web valido.",date:"Inserisci una data valida.",dateISO:"Inserisci una data valida (ISO).",number:"Inserisci un numero valido.",digits:"Inserisci solo numeri.",creditcard:"Inserisci un numero di carta di credito valido.",equalTo:"Il valore non corrisponde.",...});

Because scripts.min.js gets loaded in the footer, it should not contain scripts that need to be loaded in the header. Manually load those scripts separately in the header and you should be fine.

If you don’t know whether a script needs to be loaded in the header, check the script’s docs or trial and error to get as much in the footer as possible.

Ok. Here is an issue: I’m using plugins that needs to be compiled in a specific order. How can tell to grunt the order to concatenate the js files? If possible, not writing a line under uglify for each scripts.

I’ve updated the online project. That error is gone, but when I click something (for example a thumbnail in the gallery) the console says:

TypeError: $(...).offset(...) is undefined

Have you some ideas?

You would only need to manually declare the higher priority scripts in uglify; the rest would be added by the match (*) rules. The alternative would be to try adding an ordinal to the filenames, to see if the scripts are loaded alphabetically.

Unfortunately, this does not seem specific to Roots or Grunt. If you read the error carefully you might be pointed in the right direction, and if it is plugin related then contacting the author or posting on their support forum would be best.

Either way, I thought I would be nice and explain an error that shows up on your home page. You have bounded a click event to all ‘a’ elements and then you try to get the href attribute. This explains the errors that pop up when you click on elements on your home page which do not have a href attribute.

The gallery related error specifically shows this as the offending line:

$('[name="'+$.attr(this,"href").substr(1)+'"]').offset().top

Do you know what element this jQuery selector is trying to target? When you figure that out you might figure out why you have this error. The following might help: http://api.jquery.com/attr/

Anyway, I hate to say this but this thread has gone way beyond the original issue and is no longer related to Grunt compile errors. If one of the mods agrees, it is probably time to close it

1 Like