Using MVC Razor with Javascript.

78 views
Skip to first unread message

Rudy Hinojosa

unread,
Oct 8, 2014, 12:12:22 PM10/8/14
to yuicom...@googlegroups.com
I use MVC C# with heavy use of Razor Syntax and JavaScript intertwined. example:  @ViewBag.this @ViewData that.

I noticed the yuicompressor does not like this.  Is there any way to escape the @ symbol

just as an example:  

var x = @ViewBag.Name;

Joey Smith

unread,
Nov 1, 2014, 7:13:59 PM11/1/14
to yuicom...@googlegroups.com
Unfortunately not. YUICompressor works by parsing the Javascript through Mozilla's Rhino (java-based implementation of javascript); that parser enforces JavaScript identifier naming conventions, where an '@' is not a valid part of an identifier.
Reply all
Reply to author
Forward
0 new messages