コーヒースクリプトをシナトラで動作させようとしています。私は両方のテクノロジーに慣れていないので、これはおそらくばかげたことです。私の問題は、coffeescript が javascript にコンパイルされますが、ページ上で実行されず、代わりに html として表示されることです。
#sinatra app
require 'coffee-script'
get "/test.js" do
coffee :hello
end
#hello.coffee
alert "hello world"
#My page (/test.js) doesn't execute the js - just displays the code
#On screen in the browser I get this:
(function() {
alert("hello world");
}).call(this);
#In the HTML I get this within the body tags
<pre style="word-wrap: break-word; white-space: pre-wrap;">(function() {
alert('hello world!');
}).call(this);
</pre>