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

Make NelmioJsLoggerBundle usable without inline JavaScript #9

Open
thkoch2001 opened this issue Oct 20, 2014 · 3 comments
Open

Make NelmioJsLoggerBundle usable without inline JavaScript #9

thkoch2001 opened this issue Oct 20, 2014 · 3 comments

Comments

@thkoch2001
Copy link

Hi,

I just found NelmioJsLoggerBundle while fetching nelmio/security-bundle into my project. We might just include JS error logging too. But we want to get rid of inline JavaScript too!

It should be easy to also provide a JavaScript file that can be included instead of the inline JavaScript generated by the twig tags.

Would you be interested in a PR for that?

@Seldaek
Copy link
Member

Seldaek commented Oct 20, 2014

I'm all for it but it might prove a bit hard to do since you have dynamic bits in there like the reporting URL, log function name and possibly others. In any case if you figure it out and get it to work well feel free to send a PR!

@stof
Copy link
Contributor

stof commented Oct 20, 2014

An easy way to do it could be to provide a controller rendering the JS code. This way, it could handle the dynamic bits easily. However, this does not play nicely with combining assets, and requires booting the framework to render the asset.
An alternative is to provide a command dumping a static JS file with it. It would work fine as long as your router is configured properly for usage in the CLI

@thkoch2001
Copy link
Author

We have a very elegant solution how we pass data to JavaScript (german):

http://www.comsolit.com/blog/2014/04/datenuebergabe-innerhalb-webapplikationen

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

No branches or pull requests

3 participants