Open mbrammer opened 9 years ago
This is likely an issue with Uglify, and not this task, which is just a wrapper. Have you tried running the source through the uglify command line? Does it also resort your code?
Yes I have and no it doesn't sort the code.
I used uglifyjs js/.generated/public/global.js -o webroot/js/global.js
So the problem seems to be grunt-contrib-uglify.
Which version are you comparing against? The development version? If so, try turning on the beautify flag to the CLI. More generally make sure that the options are the same when you're comparing.
Oh sorry, forgot to mention that. No, the production is used. I have specially added beautify: false
, but I didn't change anything.
I just tried to turn on beautify and it's also sorted.
Tried a more basic config and started grunt uglify:production
uglify: {
production: {
files: {
'js/global.min.grunt.js': ['js/.generated/public/global.js']
}
}
}
Same problem. BTW: I'm using the latest version 0.6.0 of grunt-contrib-uglify
@jmeas Can you reproduce this issue?
+1, i'm experiencing this as well.
prod:
options:
banner: "<%= banner %>"
screwIE8: true
compress: drop_console: true
files:
"<%= dirs.build %>/js/app.js":"<%= app.js %>"
the array of app.js is not respected, breaking the production minified code. i havent tried uglify from the command line, but will try now.
I also have this issue on grunt contrib uglify 2.3.0
uglify: {
common: {
options: {
mangle: true,
compress: {
drop_console: true, // <- removes console.log
hoist_funs: false //
}
},
files: {
"<%= paths.compiled %>/common.min.js": [
'<%= paths.vendor %>/jquery-ui/jquery-ui.min.js',
'<%= paths.vendor %>/jquery.countdown/jquery.countdown.min.js',
'<%= paths.vendor %>/bootstrap/bootstrap.min.js',
'<%= paths.vendor %>/jquery-media/jquery.viewportchecker.min.js',
'<%= paths.static %>/jquery-media/js/jquery.countTo.js',
'<%= paths.vendor %>/vue/vue.min.js',
'<%= paths.vendor %>/vue/vue-resource.min.js',
'<%= paths.vendor %>/vue/vue-infinite-loading.js',
'<%= paths.static %>/js/components/ajax-utils.js',
'<%= paths.static %>/js/global.js',
'<%= paths.static %>/js/components/selecttextevent.js',
'<%= paths.static %>/js/components/smart_select.js',
'<%= paths.static %>/js/components/utils.js',
'<%= paths.static %>/js/components/words.js',
'<%= paths.static %>/js/components/auth.js',
'<%= paths.static %>/js/sections/landing.js',
'<%= paths.static %>/js/sections/socials.js',
'<%= paths.static %>/js/sections/actions.js',
'<%= paths.static %>/js/sections/publications.js',
'<%= paths.static %>/js/sections/projects.js',
'<%= paths.static %>/js/sections/people.js',
],
},
},
}
When I'm running uglifier, the code in the destination file is not arranged like in the source file.
Short Example Source
Destination
Real Example Source
Destination
My Config
Did I do something wrong or is it a bad bug?!