diff --git a/features/rendering.feature b/features/rendering.feature index 5f71e2cd..6ceaef57 100644 --- a/features/rendering.feature +++ b/features/rendering.feature @@ -27,8 +27,8 @@ Feature: Rendering Then the _site directory should not exist And I should see "Invalid CSS after" in the build output - Scenario: Don't render liquid in CoffeeScript - Given I have an "index.coffee" page that contains "hey='for {{site.animal}}'" + Scenario: Render liquid in CoffeeScript + Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'" When I run jekyll build Then the _site directory should exist - And I should see "hey = 'for {{site.animal}}';" in "_site/index.js" + And I should see "hey = 'for cicada';" in "_site/index.js" diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index d513d737..72d825fa 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -162,16 +162,14 @@ module Jekyll # Determine whether the file should be rendered with Liquid. # - # Returns false if the document is either an asset file or a yaml file, - # true otherwise. + # Always returns true. def render_with_liquid? - !coffeescript_file? + true end # Determine whether the file should be placed into layouts. # - # Returns false if the document is either an asset file or a yaml file, - # true otherwise. + # Returns false if the document is an asset file. def place_in_layout? !asset_file? end diff --git a/site/_docs/assets.md b/site/_docs/assets.md index 23bf4953..c2965bdf 100644 --- a/site/_docs/assets.md +++ b/site/_docs/assets.md @@ -25,6 +25,15 @@ have a file named `css/styles.scss` in your site's source folder, Jekyll will process it and put it in your site's destination folder under `css/styles.css`. +
+
Jekyll processes all Liquid filters and tags in asset files
+

If you are using Mustache + or another JavaScript templating language that conflicts with + the Liquid template syntax, you + will need to place {% raw %} and + {% endraw %} tags around your code.

+
+ ## Sass/SCSS Jekyll allows you to customize your Sass conversion in certain ways. diff --git a/test/source/js/coffeescript.coffee b/test/source/js/coffeescript.coffee index e0e066b1..9531a7cb 100644 --- a/test/source/js/coffeescript.coffee +++ b/test/source/js/coffeescript.coffee @@ -1,4 +1,5 @@ --- +message: "I knew it!" --- $ -> @@ -7,4 +8,4 @@ $ -> cube = (x) -> square(x) * x cubes = (math.cube num for num in list) - alert "I knew it!" if elvis? + alert "{{ page.message }}" if elvis?