Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow static files within assets/ directory

  • Loading branch information...
commit b003b04f2da4a5613400037072e42c058fd21b85 1 parent 0103c90
@jdtornow authored
View
4 lib/plate/partial.rb
@@ -22,7 +22,9 @@ def name
# The content for the current partial using the given locals hash
def render(locals = {})
- @locals = locals.symbolize_keys!
+ @locals = locals.symbolize_keys
+ @locals_proxy = nil
+
result = self.rendered_body
@locals = nil
@locals_proxy = nil
View
10 lib/plate/static_page.rb
@@ -3,7 +3,15 @@ module Plate
# site exactly as it is.
class StaticPage < Page
def file_path
- base = Pathname.new(File.join(self.site.source, 'content'))
+ content_dir = File.join(self.site.source, 'content')
+ assets_dir = File.join(self.site.source, 'assets')
+
+ base = Pathname.new(content_dir)
+
+ if self.file.to_s.start_with?(assets_dir)
+ base = Pathname.new(assets_dir)
+ end
+
current = Pathname.new(self.file)
dirs = current.relative_path_from(base)
View
BIN  test/sample/assets/img/photo.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 test/test_builder.rb
@@ -423,7 +423,7 @@ class TestBuilder < Test::Unit::TestCase
builder.render!
assert_equal 4, builder.site.posts.size
- assert_equal 16, builder.site.pages.size
+ assert_equal 17, builder.site.pages.size
assert_equal 6, builder.site.assets.size
assert_equal 1, builder.site.drafts.size
@@ -440,7 +440,7 @@ class TestBuilder < Test::Unit::TestCase
assert_equal 5, Dir.glob(sample_destination('**/*.css')).size
# Images should be copied as-is
- assert_equal 1, Dir.glob(sample_destination('**/*.jpg')).size
+ assert_equal 2, Dir.glob(sample_destination('**/*.jpg')).size
# Javascript too
assert_equal 3, Dir.glob(sample_destination('**/*.js')).size
Please sign in to comment.
Something went wrong with that request. Please try again.