This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

pratyushpundir6424
pratyushpundir6424

Hi there,

I'm working on a new theme and I keep running into errors when using the built-in minification/concatenation of JS assets. The JS console error I get is as follows:

Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(...) is not a function

I'm using the in-built way of achieving minification/concatenation by passing the JS files as an array like so:

<script type="text/javascript" src="{{ [
    'assets/js/jquery-1.12.2.js',
    'assets/js/jquery.sparkle.js',
    'assets/js/jquery.mousewheel.js',
    'assets/js/jquery.easing.js',
    'assets/js/jquery.debouncedresize.js',
    'assets/js/jquery.jscrollpane.js',
    'assets/js/jquery.history.js',
    'assets/js/main.js'
]|theme }}"></script>

The above method works flawlessly for CSS files but JS is turning out to be a problem. I know that my own JS is without errors since when I include the files one by one without any minification or concatenation I get no errors whatsoever.

Any help will be much appreciated.

Last updated

BUCKHORN Marketing
BUCKHORN Marketing

I have the same problem and have NEVER been able to use the minification for JS. I keep thinking OctoberCMS will fix this, but no such luck yet.

pratyushpundir6424
pratyushpundir6424

@hello11267 - Yeah I didn't spend much time on this issue. Just switched to using Gulp since it lets me do a lot of other things too.

BUCKHORN Marketing
BUCKHORN Marketing

pratyushpundir6424 said:

@hello11267 - Yeah I didn't spend much time on this issue. Just switched to using Gulp since it lets me do a lot of other things too.

I've been loading inline with the idea that I'll fix the problem later. Perhaps Gulp is the solution for me too. Thanks.

daftspunky
daftspunky

A common pitfall when minifying JavaScript is double minification. Make sure the JS files included are not already minified, as this can sometimes corrupt the code on the second pass.

pratyushpundir6424
pratyushpundir6424

daftspunk said:

A common pitfall when minifying JavaScript is double minification. Make sure the JS files included are not already minified, as this can sometimes corrupt the code on the second pass.

Thanks for pointing that out. It wasn't so in my case at least but good to know nonetheless.

BUCKHORN Marketing
BUCKHORN Marketing

Thanks @daftspunk, but I'm using minified files w/o issue. I spotted an obfuscated js file that was causing the problem in my case.

Is there some way to error trap for double minification or obfuscation?

1-7 of 7

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.