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

Unused variable warnings #11

Open
nsimonson opened this issue Jan 31, 2017 · 6 comments
Open

Unused variable warnings #11

nsimonson opened this issue Jan 31, 2017 · 6 comments
Assignees
Labels

Comments

@nsimonson
Copy link

Using <%= results in unused variable warnings. 2.0.5 fixed issues with characters being escaped improperly, but currently are only good for passing through template params.

I would like to have absolute urls for my images and I would do that like this: <%= MyApp.Router.Helpers.static_url(MyApp.Endpoint, ~s(/images/img.png)) %>

This works as expected, but I can't do this because it emits a warning that this is an unused variable.

A possible fix for this would be, instead of pulling out everything between <%= as a variable only extracting @.... This is how eex templates work in the first place.

@jfrolich
Copy link
Owner

jfrolich commented Jan 31, 2017

Great point @nsimonson, my first implementation was indeed a hacky way of pulling out and setting the variables in the EEX templates. I have a new version that is more in line with other EEX templates. The bad news is that it is a breaking change. The template functions will receive a keyword list of assigns, but this also means that the variables need a leading "@" in the templates.

@brandonparsons
Copy link

brandonparsons commented Feb 1, 2017

I suspect that might fix the issues I've been having. I will try your branch.

@jfrolich
Copy link
Owner

jfrolich commented Feb 6, 2017

@brandonparsons: Did you try the branch? Let me know if it works for you, and I will prepare to release a new major version of the lib.

@brandonparsons
Copy link

@jfrolich I did try, but was having issues that I think was unrelated to this particular problem. Swapped over to just using my own EEX templates, and will inline using a different tool.

Thanks anyway!

@stephenmoloney
Copy link
Collaborator

I hope to test this over the next 2 weeks. Can you leave the issue open for a bit, I'll post back how I get on. 👍

@stephenmoloney
Copy link
Collaborator

We should just create a simple test for this. I put it on the TODO list.

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

No branches or pull requests

4 participants