blutorange / closure-compiler-maven-plugin

Combine and minimize JavaScript with Closure Compiler.
http://blutorange.github.com/closure-compiler-maven-plugin
Apache License 2.0
52 stars 6 forks source link

outputFileName doesn't affect resulting merged file name #52

Closed adrianfish closed 5 years ago

adrianfish commented 5 years ago

If you set outputFileName you would expect that the final, merged and minified file would be called that, but it is always script.min.js. This means I have to apply another maven plugin to change that name and it is non descriptive.

blutorange commented 5 years ago

Hi, thanks for reporting it. I see you also submitted a fix, I appreciate that. However, I'm not quite sure I understand the problem.

I tried to reproduce the issue by adding a new test, but it works fine for me (with and without merge/minify), see the example below.

Click to see working example with outputFilename ```xml com.github.blutorange closure-compiler-maven-plugin 2.9.0 ${project.basedir} ${project.build.directory} default-minify generate-resources minify false false merge+minify.js minify-only generate-resources minify true false minify-only-#{basename}.js merge-only generate-resources minify false true merge-only.js neither-merge-nor-minify generate-resources minify true true no-merge-no-minify-#{basename}.js ``` Run against two input files, `hello1.js` and `hello2.js`, this produces the following files as I would expect it to: * `merge-only.js` * `minify-only-hello1.js` * `minify-only-hello2.js` * `no-merge-no-minify-hello1.js` * `no-merge-no-minify-hello2.js` * `merge+minify.js`
blutorange commented 5 years ago

Oh, I think the issue is that the option needs to be spelled outputFilename (with a lowercase n). But in the documentation and the readme, it is sometimes spelled with a capital N (outputFileName).

I'll update the documentation. Does it work for you if you spell it outputFilename ?

adrianfish commented 5 years ago

I realised after a while that the param was spelt differently, however, what I was trying to do was just pass the filename I wanted, without the tokens, and bypass the interpolator in that scenario. Maybe I was just using it wrong :)

blutorange commented 5 years ago

Hmm, thanks for checking. Just passing a filename should work, see the example above (if there are no placeholders, nothing is interpolated). How did you configure the plugin in the pom.xml?

<configuration>
    <skipMerge>false</skipMerge>
    <skipMinify>false</skipMinify>
    <outputFilename>merge+minify.js</outputFilename>
</configuration>
adrianfish commented 5 years ago

You're totall right! I must have got tangled up when using outputFileName and written that code at that point, before trying outputFilename. I'm closing this. Thanks for the good work on this project, keeping up with the latest Closure version.

blutorange commented 5 years ago

I'm glad it works now for you. But thanks anyway, I updated the docs to clear up the confusion with the name.