Closed Globegitter closed 7 years ago
have a look at this stackoverflow question and #45
Thank you @thanpolas. And in regards of leaving the naming the same, is that also possible? Or would I have to add something like .min.js?
that's up to you, check out Grunt docs http://gruntjs.com/configuring-tasks
Hmmm, I looked into it but I don't seem to get it to work the way I imagine it. Having:
expand: true,
src: ['public/dist/scripts/*.js'],
ext: '.min.js'
Works perfectly. But as soon as I remove the ext
or change it to ext: '.js'
it stops working.
Im not really sure if thats in this package's realm... which task are you using? paste your gruntconfig and the output, please add in the task's options debug: true
Oh, I am using your package:
closureCompiler: {
options: {
compilerFile: 'compiler-latest/compiler.jar',
checkModified: true,
compilerOpts: {
compilation_level: 'SIMPLE_OPTIMIZATIONS',
externs: ['public/scripts/extern.js'],
define: ["'goog.DEBUG=false'"],
warning_level: 'verbose',
jscomp_off: ['checkTypes', 'fileoverviewTags'],
summary_detail_level: 3,
output_wrapper: '"(function(){%output%}).call(this);"'
},
execOpts: {
maxBuffer: 999999 * 1024
}
},
dist: {
expand: true,
src: ['public/dist/scripts/*.js'],
ext: '.min.js'
}
}
So having grunt-closure-tools
configured like this works, though ideally I would just like for the same files to be overwritten. So if I have a components.js
it now gets minified into components.min.js
, but I would like for this package to just overwrite components.js
.
Does that make more sense now? should I still run it with debug: true
?
Though it seems I just ran into a bigger problem, which might be out of your hands and bring this endeavor to a halt. I don't seem to be able to define some function-names that closure-compiler should not rename, such as require('handlebars')
. Didn't find any practical solution on that.
you need to use a custom externs file.
Overwriting on sources is bad practice for Grunt, you need to add a few more steps to your build process that will rename and move files around so you get the result you want
@thanpolas I don't agree with you. Overwriting on sources is not bad practice for Grunt because any people need have different build process like me. UglifyJS for example do this work fine https://github.com/gruntjs/grunt-contrib-uglify and I also want to see this feature in this module.
@vovan22 as you can see from the number of contributors in this repository, pull requests are welcome :)
Although, i am not sure that this is not already supported...
@Globegitter is it ok to close this issue? is there something todo here?
closing due to inactivity, feel free to re-open if the issue persists.
Using ember.js you need to minify multiple js files but also get them out as separate js files for it to work. Would it be somehow possible to add an option to have as many output files as input files? e.g.:
Also I noticed, that if I for example give it a wrong path for src or dest I don't get any error messages. It just blocks and I have to say it confused me for a while. So it would be really helpful if it could say something like: File does not exist.
Those two features would be really helpful. Especially the first one. Thanks for this great work so with this package btw.