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

Variables such as app.name in Pattern mappings #10369

Open
ComLock opened this issue Dec 28, 2023 · 3 comments
Open

Variables such as app.name in Pattern mappings #10369

ComLock opened this issue Dec 28, 2023 · 3 comments

Comments

@ComLock
Copy link
Member

ComLock commented Dec 28, 2023

In order to fix enonic/starter-tsup#387 I need the ability to use app.name in a Pattern mapping.
https://developer.enonic.com/docs/xp/stable/framework/mappings#pattern_mappings

Something like:

<mappings>
	<mapping controller="/site/static.js" order="50">
		<pattern>/_/static/${app.name}/.+</pattern>
	</mapping>
</mappings>

In js this would be a template literal string:

const pattern = `/_/static/${app.name}/.+`;
const re = new Regexp(pattern);
re.test(url);
@rymsha
Copy link
Contributor

rymsha commented Jan 10, 2024

Workaround is to use Gradle ReplaceTokens filter
https://docs.gradle.org/current/userguide/working_with_files.html#sec:filtering_files

@ComLock
Copy link
Member Author

ComLock commented Jan 10, 2024

Side note: @sigdestad want's me to try using service in starter-tsup rather Pattern mapping.

That should probably work, but with less control over urls. Meaning a static resource will have multiple urls, even though we'll only use the shortest one (when generating urls)

@ComLock
Copy link
Member Author

ComLock commented Mar 12, 2024

What about XP dev mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants