Using Django Pipeline, why am I running into JS errors?


I’ve configured Django Pipeline (verison 1.3.15) for a single group of JS files. I’ve configured them in the same order that they appear in my page normally. Everything works fine with collectstatic, etc. When I view the source, everything appears to have been correctly crammed into 1 monolithic JS file, but when I load the page, things are wrong. The jQuery plugins I’ve included (which worked fine before) aren’t attached to jQuery (verified via Firebug) (jQuery is passed to a closure for my plugins, not by $, so it’s not a noConflict() issue). Is there a known issue with Pipeline that I somehow have overlooked, where you can’t include multiple JavaScript files together under some circumstances, due to the way they’re compressed (Note: I’m using the JSMin compressor)?.


The problem has most likely nothing to do with the pipeline but with js syntax of your js files. Consider the following scenario:

// file1.js
var foo='bar'


// file2.js
var cat='dog'

When both of the files are separate the browser has no issue processing the js since it automatically can figure out the end of each expression however when you combine and minify the two files you get something like:

var foo='bar' var cat='dog'

The above is clearly a syntax error. So most likely something similar is happening in your case. To solve this make sure that all of the files have absolutely valid js syntax (which is most cases are just missing semicolons).

Answered By – miki725

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.