From 0add2e6676017b4996eefff096ca5c11d7d2a182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Thu, 31 Jul 2014 08:46:22 +0200 Subject: [PATCH 01/21] Added a step to create templates on the fly --- .../lib/middleman-core/step_definitions/server_steps.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb index c61ec39d..17e6ce63 100644 --- a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb @@ -63,6 +63,10 @@ Given /^the Server is running at "([^\"]*)"$/ do |app_path| step %Q{the Server is running} end +Given /^a template named "([^\"]*)" with:$/ do |name, string| + step %Q{a file named "source/#{name}" with:}, string +end + When /^I go to "([^\"]*)"$/ do |url| @browser.get(URI.escape(url)) end From 856f05709c2422d24e99792e3961801d1db29b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Wed, 30 Jul 2014 14:39:24 +0200 Subject: [PATCH 02/21] Support template chaining for partials --- .../features/chained_templates.feature | 89 ++++++++++++++++++- .../partial-chained_templates-app/config.rb | 0 .../core_extensions/rendering.rb | 43 ++++++--- 3 files changed, 118 insertions(+), 14 deletions(-) create mode 100644 middleman-core/fixtures/partial-chained_templates-app/config.rb diff --git a/middleman-core/features/chained_templates.feature b/middleman-core/features/chained_templates.feature index b7d4e83e..7f538b65 100644 --- a/middleman-core/features/chained_templates.feature +++ b/middleman-core/features/chained_templates.feature @@ -16,4 +16,91 @@ Feature: Templates should be chainable And the file "index.html" should contain "Title" And the file "index.html" should contain "Subtitle" - And the file "index.html" should contain "Sup" \ No newline at end of file + And the file "index.html" should contain "Sup" + + Scenario: Partials are parsed by multiple template engines: Outer template has .erb and inner .md.erb + Given a fixture app "partial-chained_templates-app" + And a template named "my_template.html.erb" with: + """ +

My Template

+ + <%= partial 'my_partial' %> + """ + And a template named "my_partial.html.md.erb" with: + """ + ## My Partial + + <%= 'hello world' %> + """ + And the Server is running + When I go to "/my_template.html" + Then I should see: + """ +

My Template

+ """ + Then I should see: + """ +

My Partial

+ """ + Then I should see: + """ +

hello world

+ """ + + Scenario: Partials are parsed by multiple template engines: Outer template has .md.erb and inner .md.erb + Given a fixture app "partial-chained_templates-app" + And a template named "my_template.html.md.erb" with: + """ + # My Template + + <%= partial 'my_partial' %> + """ + And a template named "my_partial.html.md.erb" with: + """ + ## My Partial + + <%= 'hello world' %> + """ + And the Server is running + When I go to "/my_template.html" + Then I should see: + """ +

My Template

+ """ + Then I should see: + """ +

My Partial

+ """ + Then I should see: + """ +

hello world

+ """ + + Scenario: Partials are parsed by multiple template engines: Outer template has .md.erb, and inner .erb + Given a fixture app "partial-chained_templates-app" + And a template named "my_template.html.md.erb" with: + """ + # My Template + + <%= partial 'my_partial' %> + """ + And a template named "my_partial.html.erb" with: + """ +

My Partial

+ + <%= 'hello world' %> + """ + And the Server is running + When I go to "/my_template.html" + Then I should see: + """ +

My Template

+ """ + Then I should see: + """ +

My Partial

+ """ + Then I should see: + """ +

hello world

+ """ diff --git a/middleman-core/fixtures/partial-chained_templates-app/config.rb b/middleman-core/fixtures/partial-chained_templates-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index 074fa017..a4e967d3 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -146,18 +146,7 @@ module Middleman @current_locs = locs @current_opts = opts - # Keep rendering template until we've used up all extensions. This - # handles cases like `style.css.sass.erb` - content = nil - while ::Tilt[path] - begin - opts[:template_body] = content if content - content = render_individual_file(path, locs, opts, context) - path = File.basename(path, File.extname(path)) - rescue LocalJumpError - raise "Tried to render a layout (calls yield) at #{path} like it was a template. Non-default layouts need to be in #{source}/#{config[:layouts_dir]}." - end - end + content = _render_with_all_renderers(path, locs, context, opts) # If we need a layout and have a layout, use it if layout_path = fetch_layout(engine, opts) @@ -175,6 +164,34 @@ module Middleman @current_opts = nil end + private + + def _render_with_all_renderers(path, locs, context, opts, &block) + # Keep rendering template until we've used up all extensions. This + # handles cases like `style.css.sass.erb` + content = nil + + while ::Tilt[path] + begin + opts[:template_body] = content if content + + content = if block_given? + render_individual_file(path, locs, opts, context, &block) + else + render_individual_file(path, locs, opts, context) + end + + path = File.basename(path, File.extname(path)) + rescue LocalJumpError + raise "Tried to render a layout (calls yield) at #{path} like it was a template. Non-default layouts need to be in #{source}/#{config[:layouts_dir]}." + end + end + + content + end + + public + # Sinatra/Padrino compatible render method signature referenced by some view # helpers. Especially partials. # @@ -215,7 +232,7 @@ module Middleman File.read(r.source_file) else # Render the partial if found, otherwide throw exception - render_individual_file(found_partial, locals, options, self, &block) + _render_with_all_renderers(found_partial, locals, self, options, &block) end end From fee6a8b6178f2e4ca54e6dce343b66733b30b0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Thu, 31 Jul 2014 13:13:07 +0200 Subject: [PATCH 03/21] Make rubocop happy --- .../lib/middleman-core/core_extensions/rendering.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index 02f98eab..d2c7d1fd 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -176,10 +176,10 @@ module Middleman opts[:template_body] = content if content content = if block_given? - render_individual_file(path, locs, opts, context, &block) - else - render_individual_file(path, locs, opts, context) - end + render_individual_file(path, locs, opts, context, &block) + else + render_individual_file(path, locs, opts, context) + end path = File.basename(path, File.extname(path)) rescue LocalJumpError From 5a85d177c2e4a8bee708bd94f4a69c77fa7bcd0a Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Fri, 29 Aug 2014 10:24:45 -0700 Subject: [PATCH 04/21] Catch File read exceptions in frontmatter --- .../lib/middleman-core/core_extensions/front_matter.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index ac683db7..da5897f7 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -176,7 +176,14 @@ module Middleman::CoreExtensions return [data, nil] if !app.files.exists?(full_path) || ::Middleman::Util.binary?(full_path) - content = File.read(full_path) + # Avoid weird race condition when a file is renamed. + content = begin + File.read(full_path) + rescue ::EOFError + rescue ::IOError + rescue ::Errno::ENOENT + "" + end begin if content =~ /\A.*coding:/ From 313a2398d48a0d74ae4fc9c5ffa159292b51d2c9 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Tue, 2 Sep 2014 12:43:20 -0700 Subject: [PATCH 05/21] attempt to get compass 1 working --- middleman-core/lib/middleman-more/core_extensions/compass.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/middleman-core/lib/middleman-more/core_extensions/compass.rb b/middleman-core/lib/middleman-more/core_extensions/compass.rb index 1d3c13c0..ccf586aa 100644 --- a/middleman-core/lib/middleman-more/core_extensions/compass.rb +++ b/middleman-core/lib/middleman-more/core_extensions/compass.rb @@ -27,6 +27,7 @@ class Middleman::CoreExtensions::Compass < ::Middleman::Extension compass_config.images_dir = app.config[:images_dir] compass_config.http_path = app.config[:http_prefix] + compass_config.additional_import_paths = [] app.config[:sass_assets_paths].each do |path| compass_config.add_import_path path end From b78515ce91c55f49b1dffc8e8ebb3f69b771719d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Tue, 9 Sep 2014 09:02:50 +0200 Subject: [PATCH 06/21] Fixed rubocop offense --- .../lib/middleman-core/core_extensions/front_matter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index da5897f7..b7b099d3 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -182,7 +182,7 @@ module Middleman::CoreExtensions rescue ::EOFError rescue ::IOError rescue ::Errno::ENOENT - "" + '' end begin From fbe1585ce6d58635e89e9db6c9354017a38f652f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Tue, 9 Sep 2014 09:14:45 +0200 Subject: [PATCH 07/21] Rubocop fails faster than 'rake test' --- Rakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 5176f04e..70c8ab32 100644 --- a/Rakefile +++ b/Rakefile @@ -43,10 +43,11 @@ end desc 'Run tests for all middleman gems' task :test do + Rake::Task['rubocop'].invoke + GEM_PATHS.each do |g| Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake test" } end - Rake::Task['rubocop'].invoke end desc 'Run specs for all middleman gems' From 55e3c932787e8f5ffcf72d2f5b8e0e8ab6ef65b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Tue, 9 Sep 2014 09:07:18 +0200 Subject: [PATCH 08/21] Feature tests for force-option --- middleman-core/features/cli_init.feature | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/middleman-core/features/cli_init.feature b/middleman-core/features/cli_init.feature index d6d5b4b4..1bde5a54 100644 --- a/middleman-core/features/cli_init.feature +++ b/middleman-core/features/cli_init.feature @@ -98,3 +98,54 @@ Feature: Middleman CLI | config.rb | | config.ru | | Gemfile | + + Scenario: Enforce creation of Mobile HTML5 project + When I run `middleman init MY_PROJECT --template=mobile` + When I run `middleman init MY_PROJECT --template=mobile --force` + Then a directory named "MY_PROJECT" should exist + And the output should contain: + """ + identical + """ + And the output should contain: + """ + exist + """ + Scenario: Enforce creation of HTML5 project + When I run `middleman init MY_PROJECT --template=html5` + When I run `middleman init MY_PROJECT --template=html5 --force` + Then a directory named "MY_PROJECT" should exist + And the output should contain: + """ + identical + """ + And the output should contain: + """ + exist + """ + + Scenario: Enforce creation of default project + When I run `middleman init MY_PROJECT --template=default` + When I run `middleman init MY_PROJECT --template=default --force` + Then a directory named "MY_PROJECT" should exist + And the output should contain: + """ + identical + """ + And the output should contain: + """ + exist + """ + + Scenario: Enforce creation of empty project + When I run `middleman init MY_PROJECT --template=empty` + When I run `middleman init MY_PROJECT --template=empty --force` + Then a directory named "MY_PROJECT" should exist + And the output should contain: + """ + identical + """ + And the output should contain: + """ + exist + """ From d45911f7b86221a698a9ec6306803b0164d4842a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Tue, 9 Sep 2014 09:15:58 +0200 Subject: [PATCH 09/21] Add force-option to init --- middleman-core/lib/middleman-core/cli/init.rb | 5 +++++ .../lib/middleman-core/templates/default.rb | 22 +++++++++---------- .../lib/middleman-core/templates/empty.rb | 4 ++-- .../lib/middleman-core/templates/html5.rb | 6 ++--- .../lib/middleman-core/templates/local.rb | 2 +- .../lib/middleman-core/templates/mobile.rb | 6 ++--- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/middleman-core/lib/middleman-core/cli/init.rb b/middleman-core/lib/middleman-core/cli/init.rb index d9541161..08b6c4e6 100644 --- a/middleman-core/lib/middleman-core/cli/init.rb +++ b/middleman-core/lib/middleman-core/cli/init.rb @@ -40,6 +40,11 @@ module Middleman::Cli type: :boolean, default: false, desc: 'Skip Git ignores and keeps' + method_option 'force', + type: :boolean, + default: false, + desc: 'Overwrite existing files without any question' + # The init task # @param [String] name def init(name='.') diff --git a/middleman-core/lib/middleman-core/templates/default.rb b/middleman-core/lib/middleman-core/templates/default.rb index 6eea9b44..64d77533 100644 --- a/middleman-core/lib/middleman-core/templates/default.rb +++ b/middleman-core/lib/middleman-core/templates/default.rb @@ -19,17 +19,17 @@ class Middleman::Templates::Default < Middleman::Templates::Base # Actually output the files # @return [void] def build_scaffold! - template 'shared/config.tt', File.join(location, 'config.rb') - copy_file 'default/source/index.html.erb', File.join(location, 'source/index.html.erb') - copy_file 'default/source/layouts/layout.erb', File.join(location, 'source/layouts/layout.erb') - empty_directory File.join(location, 'source', options[:css_dir]) - copy_file 'default/source/stylesheets/all.css', File.join(location, 'source', options[:css_dir], 'all.css') - copy_file 'default/source/stylesheets/normalize.css', File.join(location, 'source', options[:css_dir], 'normalize.css') - empty_directory File.join(location, 'source', options[:js_dir]) - copy_file 'default/source/javascripts/all.js', File.join(location, 'source', options[:js_dir], 'all.js') - empty_directory File.join(location, 'source', options[:images_dir]) - copy_file 'default/source/images/background.png', File.join(location, 'source', options[:images_dir], 'background.png') - copy_file 'default/source/images/middleman.png', File.join(location, 'source', options[:images_dir], 'middleman.png') + template 'shared/config.tt', File.join(location, 'config.rb'), force: options[:force] + copy_file 'default/source/index.html.erb', File.join(location, 'source/index.html.erb'), force: options[:force] + copy_file 'default/source/layouts/layout.erb', File.join(location, 'source/layouts/layout.erb'), force: options[:force] + empty_directory File.join(location, 'source', options[:css_dir]), force: options[:force] + copy_file 'default/source/stylesheets/all.css', File.join(location, 'source', options[:css_dir], 'all.css'), force: options[:force] + copy_file 'default/source/stylesheets/normalize.css', File.join(location, 'source', options[:css_dir], 'normalize.css'), force: options[:force] + empty_directory File.join(location, 'source', options[:js_dir]), force: options[:force] + copy_file 'default/source/javascripts/all.js', File.join(location, 'source', options[:js_dir], 'all.js'), force: options[:force] + empty_directory File.join(location, 'source', options[:images_dir]), force: options[:force] + copy_file 'default/source/images/background.png', File.join(location, 'source', options[:images_dir], 'background.png'), force: options[:force] + copy_file 'default/source/images/middleman.png', File.join(location, 'source', options[:images_dir], 'middleman.png'), force: options[:force] end end diff --git a/middleman-core/lib/middleman-core/templates/empty.rb b/middleman-core/lib/middleman-core/templates/empty.rb index 1ae364c5..58d25693 100644 --- a/middleman-core/lib/middleman-core/templates/empty.rb +++ b/middleman-core/lib/middleman-core/templates/empty.rb @@ -13,8 +13,8 @@ class Middleman::Templates::Empty < Middleman::Templates::Base # Actually output the files # @return [void] def build_scaffold! - create_file File.join(location, 'config.rb'), "\n" - empty_directory File.join(location, 'source') + create_file File.join(location, 'config.rb'), "\n", force: options[:force] + empty_directory File.join(location, 'source'), force: options[:force] end end diff --git a/middleman-core/lib/middleman-core/templates/html5.rb b/middleman-core/lib/middleman-core/templates/html5.rb index 56422032..77b7e544 100644 --- a/middleman-core/lib/middleman-core/templates/html5.rb +++ b/middleman-core/lib/middleman-core/templates/html5.rb @@ -19,9 +19,9 @@ class Middleman::Templates::Html5 < Middleman::Templates::Base # Output the files # @return [void] def build_scaffold! - template 'shared/config.tt', File.join(location, 'config.rb') - directory 'html5/source', File.join(location, 'source') - empty_directory File.join(location, 'source') + template 'shared/config.tt', File.join(location, 'config.rb'), force: options[:force] + directory 'html5/source', File.join(location, 'source'), force: options[:force] + empty_directory File.join(location, 'source'), force: options[:force] end end diff --git a/middleman-core/lib/middleman-core/templates/local.rb b/middleman-core/lib/middleman-core/templates/local.rb index 08d35932..9d8c5594 100644 --- a/middleman-core/lib/middleman-core/templates/local.rb +++ b/middleman-core/lib/middleman-core/templates/local.rb @@ -9,7 +9,7 @@ class Middleman::Templates::Local < Middleman::Templates::Base # Just copy from the template path # @return [void] def build_scaffold! - directory options[:template].to_s, location + directory options[:template].to_s, location, force: options[:force] end end diff --git a/middleman-core/lib/middleman-core/templates/mobile.rb b/middleman-core/lib/middleman-core/templates/mobile.rb index 8137c0dd..ba02cbb2 100644 --- a/middleman-core/lib/middleman-core/templates/mobile.rb +++ b/middleman-core/lib/middleman-core/templates/mobile.rb @@ -14,9 +14,9 @@ class Middleman::Templates::Mobile < Middleman::Templates::Base # Output the files # @return [void] def build_scaffold! - template 'shared/config.tt', File.join(location, 'config.rb') - directory 'mobile/source', File.join(location, 'source') - empty_directory File.join(location, 'source') + template 'shared/config.tt', File.join(location, 'config.rb'), force: options[:force] + directory 'mobile/source', File.join(location, 'source'), force: options[:force] + empty_directory File.join(location, 'source'), force: options[:force] end end From e326e10e982df76da454ab3fe9fd5e29356655f5 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 15 Sep 2014 15:36:41 -0700 Subject: [PATCH 10/21] listen gem started using full paths instead of relative. Fixes #1374 --- middleman-core/lib/middleman-core/preview_server.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/preview_server.rb b/middleman-core/lib/middleman-core/preview_server.rb index ef3cd21c..4053ad04 100644 --- a/middleman-core/lib/middleman-core/preview_server.rb +++ b/middleman-core/lib/middleman-core/preview_server.rb @@ -208,8 +208,12 @@ module Middleman # @param [Array] paths Array of paths to check # @return [Boolean] Whether the server needs to reload def needs_to_reload?(paths) + relative_paths = paths.map do |p| + Pathname(p).relative_path_from(Pathname(app.root)).to_s + end + match_against = [ - %r{^config\.rb}, + %r{^config\.rb$}, %r{^lib/[^\.](.*)\.rb$}, %r{^helpers/[^\.](.*)\.rb$} ] @@ -220,7 +224,7 @@ module Middleman end end - paths.any? do |path| + relative_paths.any? do |path| match_against.any? do |matcher| path =~ matcher end From 1b0b6661302e962dbd04a258b4dd26cbf8b3d16d Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 15 Sep 2014 15:36:57 -0700 Subject: [PATCH 11/21] bump --- middleman-core/lib/middleman-core/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index a966a46f..ef45419e 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,5 @@ module Middleman # Current Version # @return [String] - VERSION = '3.3.5' unless const_defined?(:VERSION) + VERSION = '3.3.6' unless const_defined?(:VERSION) end From 17cddce67593c2d8f11ae7b57ab40fc0a9aa218d Mon Sep 17 00:00:00 2001 From: minusfive Date: Sun, 28 Sep 2014 16:39:46 -0400 Subject: [PATCH 12/21] Parse asset-hashes on JSON files --- middleman-core/features/asset_hash.feature | 20 ++++++++++++++++++- .../asset-hash-app/source/api.json.erb | 1 + .../asset-hash-app/source/subdir/api.json.erb | 1 + .../middleman-more/extensions/asset_hash.rb | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 middleman-core/fixtures/asset-hash-app/source/api.json.erb create mode 100644 middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb diff --git a/middleman-core/features/asset_hash.feature b/middleman-core/features/asset_hash.feature index 59c92d29..a6462098 100644 --- a/middleman-core/features/asset_hash.feature +++ b/middleman-core/features/asset_hash.feature @@ -1,5 +1,5 @@ Feature: Assets get a file hash appended to their and references to them are updated - Scenario: Hashed-asset files are produced, and HTML, CSS, and JavaScript gets rewritten to reference the new files + Scenario: Hashed-asset files are produced, and HTML, CSS, JSON and JavaScript gets rewritten to reference the new files Given a successfully built app at "asset-hash-app" When I cd to "build" Then the following files should exist: @@ -14,6 +14,8 @@ Feature: Assets get a file hash appended to their and references to them are upd | index.html | | subdir/index.html | | other/index.html | + | api.json | + | subdir/api.json | And the following files should not exist: | images/100px.png | | images/100px.jpg | @@ -33,6 +35,12 @@ Feature: Assets get a file hash appended to their and references to them are upd And the file "other/index.html" should contain 'href="../stylesheets/site-50eaa978.css"' And the file "other/index.html" should contain 'src="../javascripts/application-1d8d5276.js"' And the file "other/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"' + And the file "api.json" should contain 'images/100px-5fd6fb90.gif' + And the file "api.json" should contain 'images/100px-5fd6fb90.jpg' + And the file "api.json" should contain 'images/100px-1242c368.png' + And the file "subdir/api.json" should contain 'images/100px-5fd6fb90.gif' + And the file "subdir/api.json" should contain 'images/100px-5fd6fb90.jpg' + And the file "subdir/api.json" should contain 'images/100px-1242c368.png' Scenario: Hashed assets work in preview server Given the Server is running at "asset-hash-app" @@ -53,6 +61,14 @@ Feature: Assets get a file hash appended to their and references to them are upd Then I should see "img.src = '/images/100px-5fd6fb90.jpg'" When I go to "/stylesheets/site-50eaa978.css" Then I should see "background-image: url('../images/100px-5fd6fb90.jpg')" + When I go to "/api.json" + Then I should see 'images/100px-5fd6fb90.gif' + And I should see 'images/100px-5fd6fb90.jpg' + And I should see 'images/100px-1242c368.png' + When I go to "/subdir/api.json" + Then I should see 'images/100px-5fd6fb90.gif' + And I should see 'images/100px-5fd6fb90.jpg' + And I should see 'images/100px-1242c368.png' Scenario: Enabling an asset host still produces hashed files and references Given the Server is running at "asset-hash-host-app" @@ -127,6 +143,8 @@ Feature: Assets get a file hash appended to their and references to them are upd | index.html | | subdir/index.html | | other/index.html | + | api.json | + | subdir/api.json | And the following files should not exist: | images/100px-1242c368.png | | images/100px-5fd6fb90.jpg | diff --git a/middleman-core/fixtures/asset-hash-app/source/api.json.erb b/middleman-core/fixtures/asset-hash-app/source/api.json.erb new file mode 100644 index 00000000..bc2af59a --- /dev/null +++ b/middleman-core/fixtures/asset-hash-app/source/api.json.erb @@ -0,0 +1 @@ +<%= {gif: image_path('100px.gif'), jpg: image_path('100px.jpg'), png: image_path('100px.png')}.to_json %> diff --git a/middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb b/middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb new file mode 100644 index 00000000..bc2af59a --- /dev/null +++ b/middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb @@ -0,0 +1 @@ +<%= {gif: image_path('100px.gif'), jpg: image_path('100px.jpg'), png: image_path('100px.png')}.to_json %> diff --git a/middleman-core/lib/middleman-more/extensions/asset_hash.rb b/middleman-core/lib/middleman-more/extensions/asset_hash.rb index a21eba38..ae5bd0fc 100644 --- a/middleman-core/lib/middleman-more/extensions/asset_hash.rb +++ b/middleman-core/lib/middleman-more/extensions/asset_hash.rb @@ -75,7 +75,7 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension path = ::Middleman::Util.full_path(env['PATH_INFO'], @middleman_app) - if path =~ /(^\/$)|(\.(htm|html|php|css|js)$)/ + if path =~ /(^\/$)|(\.(htm|html|php|css|js|json)$)/ body = ::Middleman::Util.extract_response_text(response) if body status, headers, response = Rack::Response.new(rewrite_paths(body, path), status, headers).finish From 1142630dc815620978410eded124cd6e79435315 Mon Sep 17 00:00:00 2001 From: Ryunosuke SATO Date: Thu, 9 Oct 2014 00:30:35 +0900 Subject: [PATCH 13/21] Test against Ruby 2.2.0 on Travis CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b469087c..15a12e33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: ruby bundler_args: --without development rvm: - ruby-head + - 2.2 - 2.1.1 - 2.1.0 - 2.0.0 From ddfa37faee6c1801c29eb8c7c7252369e3e749f7 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sun, 12 Oct 2014 09:38:14 -0500 Subject: [PATCH 14/21] Use HTTPS by default in new project Gemfiles. Closes #1372 --- CHANGELOG.md | 2 ++ .../lib/middleman-core/templates/extension/Gemfile | 6 +++--- .../lib/middleman-core/templates/shared/Gemfile.tt | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1804f17f..4c12b41f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ master === +* Update new project template Gemfile to use HTTPS by default. #1372 + 3.3.5 === diff --git a/middleman-core/lib/middleman-core/templates/extension/Gemfile b/middleman-core/lib/middleman-core/templates/extension/Gemfile index 1acd5814..81495fe1 100644 --- a/middleman-core/lib/middleman-core/templates/extension/Gemfile +++ b/middleman-core/lib/middleman-core/templates/extension/Gemfile @@ -1,6 +1,6 @@ -# If you have OpenSSL installed, we recommend updating -# the following line to use "https" -source 'http://rubygems.org' +# If you do not have OpenSSL installed, update +# the following line to use "http://" instead +source 'https://rubygems.org' # Specify your gem's dependencies in <%= name %>.gemspec gemspec diff --git a/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt b/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt index ec8e0fc9..c8e3c6b7 100644 --- a/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt +++ b/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt @@ -1,6 +1,6 @@ -# If you have OpenSSL installed, we recommend updating -# the following line to use "https" -source 'http://rubygems.org' +# If you do not have OpenSSL installed, update +# the following line to use "http://" instead +source 'https://rubygems.org' gem "middleman", "~><%= Middleman::VERSION %>" From fea9a3837267684dfa8591e0a6e73538588d9d11 Mon Sep 17 00:00:00 2001 From: Nate Bird Date: Mon, 13 Oct 2014 07:42:05 -0400 Subject: [PATCH 15/21] Add 3.3.6 changes to Changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c12b41f..49dbb5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ master * Update new project template Gemfile to use HTTPS by default. #1372 +3.3.6 +=== + +* Use full paths instead of relative for `listen` gem. Fixes #1374 +* Add force option to "middleman init". #1369 +* Configuration addition for compass 1 compatibility. +* Catch File read exceptions in frontmatter. +* Remove duplicate attr_accessor. Closes #1352 +* Update sass dependency to >= 3.4.0. +* Update compass dependency to >= 1.0.0, < 2.0.0 +* Accept pandoc-style YAML frontmatter. #1350 +* Add webp to image type lists. + 3.3.5 === From 65d3a0c84f7a42805adbbfa712c24bf34eb54fb0 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 20 Oct 2014 11:24:52 -0700 Subject: [PATCH 16/21] Be a bit safer about checking source_file in Sitemap Preview. Working towards fixing #1166 --- .../lib/middleman-core/meta_pages/sitemap_resource.rb | 2 +- .../lib/middleman-core/sitemap/extensions/redirects.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb index e42176df..9d1d1ec0 100644 --- a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb +++ b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb @@ -39,7 +39,7 @@ module Middleman build_path = 'Not built' if ignored? props['Build Path'] = build_path if @resource.path != build_path props['URL'] = content_tag(:a, @resource.url, href: @resource.url) unless ignored? - props['Source File'] = @resource.source_file.sub(/^#{Regexp.escape(ENV['MM_ROOT'] + '/')}/, '') + props['Source File'] = @resource.source_file ? @resource.source_file.sub(/^#{Regexp.escape(ENV['MM_ROOT'] + '/')}/, '') : 'Dynamic' data = @resource.data props['Data'] = data.inspect unless data.empty? diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb b/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb index fdf1315f..fe34ec39 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb @@ -66,6 +66,10 @@ module Middleman super(store, path) end + def get_source_file + nil + end + def template? true end From f4ce1ff99dc6b2859d453d02d76cfea6c2d7606a Mon Sep 17 00:00:00 2001 From: Max Meyer Date: Sun, 2 Nov 2014 16:51:44 +0100 Subject: [PATCH 17/21] Switch to current working directory during testing --- .../features/working_directory.feature | 33 +++++++++++++ .../step_definitions/server_steps.rb | 49 ++++++++++++++----- 2 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 middleman-core/features/working_directory.feature diff --git a/middleman-core/features/working_directory.feature b/middleman-core/features/working_directory.feature new file mode 100644 index 00000000..9532e68f --- /dev/null +++ b/middleman-core/features/working_directory.feature @@ -0,0 +1,33 @@ +Feature: Honour working directory + Honour the working directory during testing + In order to support helpers which work with the current directories + + Scenario: Set working directory for helpers in tests + Given a fixture app "empty-app" + And a file named "source/index.erb" with: + """ + <%= Dir.getwd %> + """ + And the Server is running + When I go to "/index.html" + Then I should see: + """ + aruba + """ + + Scenario: Set working directory for config.rb in tests + Given a fixture app "empty-app" + And a file named "config.rb" with: + """ + set :my_working_directory, Dir.getwd + """ + And a file named "source/index.erb" with: + """ + <%= my_working_directory %> + """ + And the Server is running + When I go to "/index.html" + Then I should see: + """ + aruba + """ diff --git a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb index 9e4c9e3f..59119089 100644 --- a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb @@ -34,6 +34,7 @@ end Given /^the Server is running$/ do root_dir = File.expand_path(current_dir) + if File.exists?(File.join(root_dir, 'source')) ENV['MM_SOURCE'] = 'source' else @@ -48,9 +49,11 @@ Given /^the Server is running$/ do set :show_exceptions, false } - @server_inst = Middleman::Application.server.inst do - initialize_commands.each do |p| - instance_exec(&p) + in_current_dir do + @server_inst = Middleman::Application.server.inst do + initialize_commands.each do |p| + instance_exec(&p) + end end end @@ -68,41 +71,61 @@ Given /^a template named "([^\"]*)" with:$/ do |name, string| end When /^I go to "([^\"]*)"$/ do |url| - @browser.get(URI.escape(url)) + in_current_dir do + @browser.get(URI.escape(url)) + end end Then /^going to "([^\"]*)" should not raise an exception$/ do |url| - expect{ @browser.get(URI.escape(url)) }.to_not raise_exception + in_current_dir do + expect{ @browser.get(URI.escape(url)) }.to_not raise_exception + end end Then /^the content type should be "([^\"]*)"$/ do |expected| - expect(@browser.last_response.content_type).to start_with(expected) + in_current_dir do + expect(@browser.last_response.content_type).to start_with(expected) + end end Then /^I should see "([^\"]*)"$/ do |expected| - expect(@browser.last_response.body).to include(expected) + in_current_dir do + expect(@browser.last_response.body).to include(expected) + end end Then /^I should see '([^\']*)'$/ do |expected| - expect(@browser.last_response.body).to include(expected) + in_current_dir do + expect(@browser.last_response.body).to include(expected) + end end Then /^I should see:$/ do |expected| - expect(@browser.last_response.body).to include(expected) + in_current_dir do + expect(@browser.last_response.body).to include(expected) + end end Then /^I should not see "([^\"]*)"$/ do |expected| - expect(@browser.last_response.body).to_not include(expected) + in_current_dir do + expect(@browser.last_response.body).to_not include(expected) + end end Then /^I should not see:$/ do |expected| - expect(@browser.last_response.body).to_not include(expected.chomp) + in_current_dir do + expect(@browser.last_response.body).to_not include(expected.chomp) + end end Then /^the status code should be "([^\"]*)"$/ do |expected| - expect(@browser.last_response.status).to eq expected.to_i + in_current_dir do + expect(@browser.last_response.status).to eq expected.to_i + end end Then /^I should see "([^\"]*)" lines$/ do |lines| - expect(@browser.last_response.body.chomp.split($/).length).to eq(lines.to_i) + in_current_dir do + expect(@browser.last_response.body.chomp.split($/).length).to eq(lines.to_i) + end end From 9d49b084267a81efb4d8c67ce84dca3b9e4bf233 Mon Sep 17 00:00:00 2001 From: claudiob Date: Sat, 8 Nov 2014 13:01:05 -0800 Subject: [PATCH 18/21] Import patch to bugfix from Padrino Helpers Padrino had an issue https://github.com/padrino/padrino-framework/issues/1582 which was solved at https://github.com/padrino/padrino-framework/commit/72769fe39a2f6368a474e05102cb7c35c5fdc685#diff-526024418d0d573e08d46ba3d55c02bcR36 This commit brings the same fix back into Middleman's method that overrides Padrino's method. --- .../lib/middleman-more/core_extensions/default_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb b/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb index 39c1dc1b..c5af996b 100644 --- a/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb +++ b/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb @@ -12,7 +12,7 @@ class Padrino::Helpers::OutputHelpers::ErbHandler raw = block.call(*args) captured = template.instance_variable_get(:@_out_buf) self.output_buffer = _buf_was - engine_matches?(block) ? captured : raw + engine_matches?(block) && !captured.empty? ? captured : raw end end From c231e00f00eb7811c1d297e5fac4885bf22201a5 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 8 Nov 2014 21:06:17 -0800 Subject: [PATCH 19/21] bump --- middleman-core/lib/middleman-core/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index ef45419e..a7e7d7b4 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,5 @@ module Middleman # Current Version # @return [String] - VERSION = '3.3.6' unless const_defined?(:VERSION) + VERSION = '3.3.7' unless const_defined?(:VERSION) end From dcca8968c8905185bc295dbac444e5e689c345fe Mon Sep 17 00:00:00 2001 From: justin blecher Date: Wed, 12 Nov 2014 19:12:52 -0500 Subject: [PATCH 20/21] exclude .git folder when init'ing a local template freshly init'd middleman projects from a local template should not include the git files from that template because that's confusing. this is to help users who clone git repos into `~/.middleman/`. --- middleman-core/lib/middleman-core/templates/local.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/templates/local.rb b/middleman-core/lib/middleman-core/templates/local.rb index 9d8c5594..ee9ab58a 100644 --- a/middleman-core/lib/middleman-core/templates/local.rb +++ b/middleman-core/lib/middleman-core/templates/local.rb @@ -9,7 +9,7 @@ class Middleman::Templates::Local < Middleman::Templates::Base # Just copy from the template path # @return [void] def build_scaffold! - directory options[:template].to_s, location, force: options[:force] + directory options[:template].to_s, location, force: options[:force], exclude_pattern: /\.git\/.*/ end end From e28ed20c63c598c0e6cfd52d8bda5d625efa90b8 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Sun, 16 Nov 2014 21:25:28 +0100 Subject: [PATCH 21/21] Asset hashing for image references in srcset Fixes #1287 --- middleman-core/features/asset_hash.feature | 6 ++++++ .../asset-hash-app/source/images/200px.jpg | Bin 0 -> 1767 bytes .../asset-hash-app/source/images/300px.jpg | Bin 0 -> 2905 bytes .../asset-hash-app/source/index.html.erb | 2 +- .../lib/middleman-more/extensions/asset_hash.rb | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 middleman-core/fixtures/asset-hash-app/source/images/200px.jpg create mode 100644 middleman-core/fixtures/asset-hash-app/source/images/300px.jpg diff --git a/middleman-core/features/asset_hash.feature b/middleman-core/features/asset_hash.feature index a6462098..e8a6ace5 100644 --- a/middleman-core/features/asset_hash.feature +++ b/middleman-core/features/asset_hash.feature @@ -8,6 +8,8 @@ Feature: Assets get a file hash appended to their and references to them are upd | favicon.ico | | images/100px-1242c368.png | | images/100px-5fd6fb90.jpg | + | images/200px-c11eb203.jpg | + | images/300px-59adce76.jpg | | images/100px-5fd6fb90.gif | | javascripts/application-1d8d5276.js | | stylesheets/site-50eaa978.css | @@ -29,6 +31,9 @@ Feature: Assets get a file hash appended to their and references to them are upd And the file "index.html" should contain 'href="stylesheets/site-50eaa978.css"' And the file "index.html" should contain 'src="javascripts/application-1d8d5276.js"' And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"' + And the file "index.html" should contain 'srcset="images/100px-5fd6fb90.jpg 1x, images/200px-c11eb203.jpg 2x, images/300px-59adce76.jpg 3x"' + And the file "index.html" should contain 'src="images/100px-5fd6fb90.gif"' + And the file "index.html" should contain 'src="images/100px-1242c368.png"' And the file "subdir/index.html" should contain 'href="../stylesheets/site-50eaa978.css"' And the file "subdir/index.html" should contain 'src="../javascripts/application-1d8d5276.js"' And the file "subdir/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"' @@ -49,6 +54,7 @@ Feature: Assets get a file hash appended to their and references to them are upd And I should see 'href="stylesheets/site-50eaa978.css"' And I should see 'src="javascripts/application-1d8d5276.js"' And I should see 'src="images/100px-5fd6fb90.jpg"' + And I should see 'srcset="images/100px-5fd6fb90.jpg 1x, images/200px-c11eb203.jpg 2x, images/300px-59adce76.jpg 3x"' When I go to "/subdir/" Then I should see 'href="../stylesheets/site-50eaa978.css"' And I should see 'src="../javascripts/application-1d8d5276.js"' diff --git a/middleman-core/fixtures/asset-hash-app/source/images/200px.jpg b/middleman-core/fixtures/asset-hash-app/source/images/200px.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1a23674756dc0fbffe5a631a12a57b2f5e47c3ee GIT binary patch literal 1767 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77)~&pU}jWeU=n0x7G(T?gh3wYPgX`SV1NQf zCT12^Hg*n9E^eTLtpW^8jLghTEX=H|EG$6PwLp0W7C}}aMMFn6;lM<8r9u&-#)%6# zl$|yn6b-ugLB%+!sELzHOk6@zN>xo=LsQGd)Xdz%(#qMz)y>_*(Rn0A}ZS5VMU6UqHnL2IyjG40*Enc#8+42=DS8dw7W$U)>J9h3m zboj{8W5-XNJay^vm8;jT-?(|};iJb-o<4j2;^nK4pFV&2`tAFVpT9u3cne5E zJci~kL7=~wSXh`@*g^hcWGV+@WL#!3JiU?ciWB$$3+&-C|fPU z5a_C?=%~`bt}=@uN^6h#wd+C>kER&&-RV->yKVafl})Y5x7RX6ELuD%<6-yNiHDZ2 zRS`G1v#=t@fSs*Dby1fF11`L#`$}*Bx7szyXQnovsNelQ>g#mYbqn)8?V24{DXnvM zx4jobN%!2WTV_v_J0{MLbN{lc@0f;Zh@Xhn1ODQ(8Fz1;RJj-vy=l$GCpCXL?6%w} z`4e?s=A4x0Nxj1xzb)YUyy(!aWCeyc?&Af8v#u1Jm1fOdo*sBocg@5j2V>h9O&I43MDKM|&RdxK)=|3sqr9UF z$7Zu-=NMJHKHuPZv?kKAGDo@d==Mo_%ku8jpIqjfT%b1Rwx`sR$9xhp{e=!97kf5j zdi+^gcEav>*G~SE>+WcMkWx6pAE)^_^XJwkix`~=0)hR-@BOxHon*Om$Bxv@B?o?5 VG1zJ_JrxObU>(I2hk^Y6n*dF+TDt%M literal 0 HcmV?d00001 diff --git a/middleman-core/fixtures/asset-hash-app/source/images/300px.jpg b/middleman-core/fixtures/asset-hash-app/source/images/300px.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5a1d9e03eb5000663ac4785a9881f95e202ece6c GIT binary patch literal 2905 zcmeIwSy0nQ90&0I=RRN{5Uv0w97@1|5H3Mf5Ca59ArKA&mP5H|Dui%&0P#RMELS;1 zN(BUr2o|}q9V3DuWmM!8#F_$?qqTqn!Z@TsJMB!LY#)5$xAWbX-PxVbZ&xxRc?sm5 z9heRPf&hS|14!1v9(y;29oxmtni6u%F#LE>2qo6U$e2Rq^TN0x6sEHy#o3kNNQt$e z>(eO5f`SA1kuj7gen4bcOae|a2J8U_g+il{7&ID<#bR(WL|GX;UPetpQI4odB5%1tjI3w1dnet-$kdF!aR`LPVrB3$s0Y@Sc2`;oV0JL@#kuJzC#pvv-yQk#VH?M0N7<~qdQ&v$`BW>NLN7XklGq#B_FNdw6N+!p#!26wdn#3abI?6 z-94<1soT6#V00f&S=UUwbzy_{LH22|GyhBWH|!tRD3F0e(#L}nz+UjShgz15+stMU zKIb1WC@DQfEB7^8)ew7DGlY*dd+bkw%%t({wxkBOO2L5;Zcspp=tR+@OwSgkwxz29 zW5;;F%$%({kQBQy)Q`T%X~9!LqAAwE67fZI@Yw4-CbeXl!Q^+5~R;iF0x; z957N=UJ}$Sm`Z9ZH_tIo&%@i~i+oJ|2}8*i*ROec+4e-=q|05exC%?7eo{~kp;HIS z>fE!OrXz3>=Lc`qOk_lQOy*O_Z#u)r{T#z|nc7Xddry9U^Y>6;OOtU{uwF)@>Q!{a zWH$G*ICbw&@52v95xuveELz|*XAcgSZ&M8-i#o_%5-@mhh^r7mRW@zuzL&hEPy*(j zz-FUO`o4UWaQgE5dbcAE=nJB*@k??OourC8vYLv*bZ!!qImhxHcNm2MQN2Os?k>M6 zTa}nf!^(XwrQ~ewE5gR-$5Rb`skR3)U@k6S)iA3Z0{g}8!`!4jNj1zk>oFgjTW1BL z-H$84v8DmR<$MGu}X>gCxo2hQ&)mVl+Z zoEa)qL$Y$4zR8|cuqL$^iTM$8@e}Gw30p6s-!E{Qz4}I(3QjetaxZ?{zKdhPHO$ae zOPwI6P@&OPU7yPMK$k@cAm#cpl(B+KwP4M^pFjODMa^;E1ic`=z@2~PTu~1)<2Bvb zA6>b3?Ja04&WQ2hmG}iG(FO`w0`a`b%2E4w3l2i=eaHQ?fn(o^j;;-OS+bgvlZ|OT z!px}QRafM=etK9|?zH2iQ+1x#p^VO|_Nv!&1u(`bt%vOX#D&wUttl>&pw*d?Ve z#+;iP3wn?A-Y?}9d(2XyoQ~Z6ecgBR+R~~}*%63#SIt6=I}xTS0dnDu4B*k)FK$cQ`E&He_1FFVqZLg8 zLw|4Aoa$o5;o5Kx6{emZT3fa_<@@!Evg)xg&!O9^>8*t^M!d8i8G!Dc6Ix`Y65Y&V zzkF)wU+4_4hi9oy;_fnl4wY{pQqn

Image url:

- +

Ignored path:

diff --git a/middleman-core/lib/middleman-more/extensions/asset_hash.rb b/middleman-core/lib/middleman-more/extensions/asset_hash.rb index ae5bd0fc..2384eacb 100644 --- a/middleman-core/lib/middleman-more/extensions/asset_hash.rb +++ b/middleman-core/lib/middleman-more/extensions/asset_hash.rb @@ -91,7 +91,7 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension dirpath = Pathname.new(File.dirname(path)) # TODO: This regex will change some paths in plan HTML (not in a tag) - is that OK? - body.gsub(/([=\'\"\(]\s*)([^\s\'\"\)]+(#{@exts_regex_text}))/) do |match| + body.gsub(/([=\'\"\(,]\s*)([^\s\'\"\)]+(#{@exts_regex_text}))/) do |match| opening_character = $1 asset_path = $2