Note that there are some explanatory texts on larger screens.

plurals
  1. POrun coffeescript from *.coffee file in Asp.Net
    text
    copied!<p>I install "Mindscape Web Workbench" visual studio extensions and add LessCoffee reference from Nuget.</p> <p>In my page, I wrote those codes and it is running.</p> <pre><code>&lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt; &lt;script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/coffeescript"&gt; @fonksiyon = () -&gt; alert "I knew it!" @myalert=(myText)-&gt; alert myText &lt;/script&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;input type="button" id="deneme" onclick="fonksiyon()" value="Deneme" /&gt; &lt;br /&gt; &lt;input type="button" id="Button1" onclick="myalert('yazi veya uyari')" value="Deneme" /&gt; &lt;/asp:Content&gt; </code></pre> <p>I want to run the same code from "Coffee1.coffee" so I wrote this:</p> <p>in CoffeeScript.coffee</p> <pre><code> @fonksiyon = () -&gt; alert "I knew it!" @myalert=(myText)-&gt; alert myText </code></pre> <p>In Asp.net Page:</p> <pre><code>&lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt; &lt;script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="CoffeeScript1.coffee" type="text/coffeescript"&gt;&lt;/script&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;input type="button" id="deneme" onclick="fonksiyon()" value="Deneme" /&gt; &lt;br /&gt; &lt;input type="button" id="Button1" onclick="myalert('yazi veya uyari')" value="Deneme" /&gt; &lt;/asp:Content&gt; </code></pre> <p>But this code doesn't work.</p> <p>CoffeeLess add web.config:</p> <pre><code> &lt;httpHandlers&gt; &lt;add path="*.coffee" type="DotSmart.CoffeeScriptHandler, LessCoffee" verb="*" validate="false" /&gt; &lt;add path="*.less" type="DotSmart.LessCssHandler, LessCoffee" verb="*" validate="false" /&gt; &lt;add path="*.less.css" type="DotSmart.LessCssHandler, LessCoffee" verb="*" validate="false" /&gt; &lt;/httpHandlers&gt; &lt;/system.web&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true" /&gt; &lt;validation validateIntegratedModeConfiguration="false" /&gt; &lt;handlers&gt; &lt;add path="*.coffee" type="DotSmart.CoffeeScriptHandler, LessCoffee" verb="*" name="DotSmart.CoffeeScriptHandler" /&gt; &lt;add path="*.less" type="DotSmart.LessCssHandler, LessCoffee" verb="*" name="DotSmart.LessCssHandler" /&gt; &lt;add path="*.less.css" type="DotSmart.LessCssHandler, LessCoffee" verb="*" name="DotSmart.LessCssHandler2" /&gt; &lt;/handlers&gt; &lt;/system.webServer&gt; </code></pre> <p>I controled it with Firebug and return this error:</p> <p>'SyntaxError: reserved word "function" on line 4' when calling method: [nsIDOMEventListener::handleEvent] [Break On This Error]<br> Filtered chrome url chrome://firebug/content/net/spy.js</p> <p>What should I do?</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload