fix template read cache
This commit is contained in:
parent
9eccf59aec
commit
47eb29bcfe
6 changed files with 24 additions and 6 deletions
10
features/custom_layout_engines.feature
Normal file
10
features/custom_layout_engines.feature
Normal file
|
@ -0,0 +1,10 @@
|
|||
Feature: Custom Layout Engine
|
||||
|
||||
Scenario: Checking built folder for content
|
||||
Given a built app at "custom-layout-app"
|
||||
Then "index.html" should exist at "custom-layout-app" and include "Comment in layout"
|
||||
|
||||
Scenario: Checking server for content
|
||||
Given the Server is running at "test-app"
|
||||
When I go to "/index.html"
|
||||
Then I should see "Comment in layout"
|
1
fixtures/custom-layout-app/config.rb
Normal file
1
fixtures/custom-layout-app/config.rb
Normal file
|
@ -0,0 +1 @@
|
|||
set :erb, :layout_engine => :haml
|
1
fixtures/custom-layout-app/source/index.html.erb
Executable file
1
fixtures/custom-layout-app/source/index.html.erb
Executable file
|
@ -0,0 +1 @@
|
|||
<h1>Welcome</h1>
|
6
fixtures/custom-layout-app/source/layout.haml
Normal file
6
fixtures/custom-layout-app/source/layout.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
%html
|
||||
%head
|
||||
%title My Sample Site
|
||||
/ Comment in layout
|
||||
%body
|
||||
= yield
|
|
@ -316,11 +316,11 @@ public
|
|||
end
|
||||
|
||||
def read_raw_template(path)
|
||||
if !raw_templates_cache.has_key?(path)
|
||||
raw_templates_cache[path] = File.read(path)
|
||||
if raw_templates_cache.has_key?(path)
|
||||
raw_templates_cache[path]
|
||||
else
|
||||
File.read(path)
|
||||
end
|
||||
|
||||
raw_templates_cache[path]
|
||||
end
|
||||
|
||||
def map(map, &block)
|
||||
|
|
|
@ -69,14 +69,14 @@ module Middleman::CoreExtensions::FrontMatter
|
|||
|
||||
file = File.expand_path(file, @app.root)
|
||||
content = File.read(file)
|
||||
file = file.sub(@app.source_dir, "")
|
||||
|
||||
# @app.logger.debug :frontmatter_update, Time.now, file if @app.logging?
|
||||
result = parse_front_matter(content)
|
||||
|
||||
if result
|
||||
file = file.sub(@app.source_dir, "")
|
||||
@local_data[file] = result
|
||||
path = @app.extensionless_path(file)
|
||||
path = File.join(@app.source_dir, file)
|
||||
@app.raw_templates_cache[path] = result[1]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue