1

i have this situation:

  • i have some js libraries downloaded via bower in bower_componenents folder
  • some custom javascript in a different js folder

my concat task is the following:

concat: {
  dist: {
    src: [
      'bower_components/jquery/jquery.js',
      'bower_components/imagesloaded/imagesloaded.js',
      'js/libs/*.js',
      'js/custom/*.js'
    ],
    dest: 'js/build/production.js'
  }
}, //end concat

the result gets then processed by grunt uglifier like so:

uglify: {
  dist: {
    src: 'js/build/production.js',
    dest: '_site/js/production.min.js'
  }
}, //end uglify

what happens here is everything goes smoothly if i add just ONE library from bower_components folder (in my case jquery). if i add a second one (in my case images loaded), the resulting javascript file gets broken and no javascript works at all.

if i inspect the production.min.js file i notice all the needed code is actually there, but it doesn't work.

what am i missing? should i use grunt-bower-concat? if yes, why and will it concatenate also my custom js?

for a reference, i'm using this grunt boilerplate: https://github.com/vlrprbttst/grunt-boilerplate-v2

thanks!!

valerio0999
  • 11,458
  • 7
  • 28
  • 56
  • This might have something to do with the ``mangle`` option of uglify plugin. I would suggest disabling it (Refer to https://github.com/gruntjs/grunt-contrib-uglify#no-mangling for sample config of a grunt task) – Prayag Verma Jan 03 '16 at 11:19
  • @PrayagVerma thanks but unluckily it didn't help :/ – valerio0999 Jan 03 '16 at 19:06
  • i've tried using this tutorial http://fuseinteractive.ca/blog/automating-bower-library-integration-grunt#.Vol5a_nhBph with grunt-bower-concat but i have the same issue – valerio0999 Jan 03 '16 at 20:30

1 Answers1

0

that's fixed with:

    concat: {
        options: {
            separator: ';',
        },
        dist: {

and

    uglify: {
        options: {
            mangle: false
        },
        dist: {
valerio0999
  • 11,458
  • 7
  • 28
  • 56