After struggling with a JavaScript parse error in locales.js for quite a while, I determined the cause. The error is a missing } even though the code looks/lints fine. It is a result of multiple near-simultaneous requests in development mode.
We have a route to a stylesheet action that pulls the CSS from a database. When a page is hit (in development), the generate_locale_javascript filter is fired once for the page and again when the page loads the stylesheet action. My assumption is that this results in a partially overwritten locales.js being returned, hence the parse error.
My solution for now is as follows:
skip_after_filter :generate_locale_javascript, :only => :stylesheet
I'm submitting this so others are aware of the issue, and perhaps we can come up with a better solution in Babilu itself. Regenerating only if the yml files change should at least reduce, if not eliminate the issues.
After struggling with a JavaScript parse error in locales.js for quite a while, I determined the cause. The error is a missing } even though the code looks/lints fine. It is a result of multiple near-simultaneous requests in development mode.
We have a route to a stylesheet action that pulls the CSS from a database. When a page is hit (in development), the generate_locale_javascript filter is fired once for the page and again when the page loads the stylesheet action. My assumption is that this results in a partially overwritten locales.js being returned, hence the parse error.
My solution for now is as follows: skip_after_filter :generate_locale_javascript, :only => :stylesheet
I'm submitting this so others are aware of the issue, and perhaps we can come up with a better solution in Babilu itself. Regenerating only if the yml files change should at least reduce, if not eliminate the issues.