Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outputFileName doesn't affect resulting merged file name #52

Closed
adrianfish opened this issue Aug 29, 2019 · 6 comments
Closed

outputFileName doesn't affect resulting merged file name #52

adrianfish opened this issue Aug 29, 2019 · 6 comments
Labels
question Further information is requested

Comments

@adrianfish
Copy link

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.

adrianfish added a commit to adrianfish/closure-compiler-maven-plugin that referenced this issue Aug 29, 2019
outputFilename should be used as the final minified and merged filename,
rather than the default of script.js being forced.
@blutorange
Copy link
Owner

blutorange commented Aug 29, 2019

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
<plugin>
	<groupId>com.github.blutorange</groupId>
	<artifactId>closure-compiler-maven-plugin</artifactId>
	<version>2.9.0</version>
	<configuration>
		<baseSourceDir>${project.basedir}</baseSourceDir>
		<baseTargetDir>${project.build.directory}</baseTargetDir>
	</configuration>
	<executions>
		<execution>
		<id>default-minify</id>
			<phase>generate-resources</phase>
			<goals>
				<goal>minify</goal>
			</goals>
			<configuration>
				<skipMerge>false</skipMerge>
				<skipMinify>false</skipMinify>
				<outputFilename>merge+minify.js</outputFilename>
			</configuration>
		</execution>
		<execution>
			<id>minify-only</id>
			<phase>generate-resources</phase>
			<goals>
				<goal>minify</goal>
			</goals>
			<configuration>
				<skipMerge>true</skipMerge>
				<skipMinify>false</skipMinify>
				<outputFilename>minify-only-#{basename}.js</outputFilename>
			</configuration>
		</execution>
		<execution>
			<id>merge-only</id>
			<phase>generate-resources</phase>
			<goals>
				<goal>minify</goal>
			</goals>
			<configuration>
				<skipMerge>false</skipMerge>
				<skipMinify>true</skipMinify>
				<outputFilename>merge-only.js</outputFilename>
			</configuration>
		</execution>
		<execution>
			<id>neither-merge-nor-minify</id>
			<phase>generate-resources</phase>
			<goals>
				<goal>minify</goal>
			</goals>
			<configuration>
				<skipMerge>true</skipMerge>
				<skipMinify>true</skipMinify>
				<outputFilename>no-merge-no-minify-#{basename}.js</outputFilename>
			</configuration>
		</execution>
	</executions>
</plugin>

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 blutorange added question Further information is requested bug Something isn't working labels Aug 29, 2019
@blutorange
Copy link
Owner

blutorange commented Aug 29, 2019

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
Copy link
Author

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
Copy link
Owner

blutorange commented Aug 29, 2019

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
Copy link
Author

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 blutorange removed the bug Something isn't working label Aug 31, 2019
@blutorange
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants