Concatenating Bootstrap, jQuery and local JavaScript - breaks jQuery -
currently minify , concatenate javascript , css files local 'theme'. load bootstrap, jquery , local javascript/css files in head of website.
whilst works, result in 8 separate resource loads, rather 2 (1 js, 1 css) accomplish. (at time not looking asynchronously load multiple libraries).
i'm using grunt in build system in order invoke uglify action minifiy javascript.
below relevant part of gruntfile.js
uglify: { build: { files: [{ src: ['src/main/webapp/js/vendor/*.js', 'src/main/webapp/js/*.js', '!src/main/webapp/js/output.min.js'], dest: 'src/main/webapp/js/output.min.js' }] } }
i thought specifying minified jquery , bootstrap libraries uglify action combine libraries minified 'theme' javascript. when doing so, receive following errors in browser:
uncaught error: bootstrap's javascript requires jquery uncaught referenceerror: $ not defined uncaught referenceerror: $ not defined
obviously concatenating , minifying these files i'm breaking something.
does have suggestions? i've tried using minified , unminified versions of bootstrap , jquery libraries sure.
cheers, andy
the problem include bootstrap's javascript files before jquery.
bootstrap jquery dependent. need include jquery first , needs jquery.
Comments
Post a Comment