Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #264 to get stand alone coffee files compiling to .js files and…
… added a few example jade files using embedded or external coffeescript
- Loading branch information
Showing
13 changed files
with
183 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
h1 Embedded CoffeeScript demo | ||
|
||
p This should demonstrate some CoffeeScript being compiled on the server to JavaScript and included inside a Jade page | ||
|
||
:coffeescript | ||
alert "Hello, Coffee embedded!" | ||
p You should get an alert :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
h1 External CoffeeScript demo | ||
|
||
p This should demonstrate some CoffeeScript being compiled on the server to JavaScript and referenced inside a Jade page | ||
|
||
script(src="foo.js" type="text/javascript") | ||
|
||
p You should get an alert :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert "Hello, from included Coffee JavaScript file!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
h1 CoffeeScript Examples | ||
|
||
p Here are a few samples of using CoffeeScript and SASS/SCSS with Scalate using Jade | ||
|
||
ul | ||
li | ||
a(href="embedded") Embedded CoffeeScript inside Jade | ||
li | ||
a(href="external") External CoffeeScript referenced in Jade | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
scalate-core/src/test/resources/org/fusesource/scalate/filter/sample.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert "Hello, Coffee!" |
23 changes: 23 additions & 0 deletions
23
scalate-core/src/test/scala/org/fusesource/scalate/filter/CoffeeScriptPipelineTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.fusesource.scalate.filter | ||
|
||
import org.fusesource.scalate.TemplateTestSupport | ||
import org.fusesource.scalate.util.ResourceLoader | ||
import org.fusesource.scalate.support.TemplateFinder | ||
|
||
class CoffeeScriptPipelineTest extends TemplateTestSupport { | ||
|
||
lazy val finder = new TemplateFinder(engine) | ||
|
||
test("coffeescript pipeline") { | ||
assertUriOutputContains("/org/fusesource/scalate/filter/sample.js", | ||
"""(function() { | ||
alert("Hello, Coffee!"); | ||
}).call(this); | ||
""") | ||
} | ||
|
||
override protected def fromUri(uri: String) = { | ||
val newUri = finder.findTemplate(uri).getOrElse(uri) | ||
super.fromUri(newUri) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters