middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
326 stars 179 forks source link

Articles and Templates in blog subfolder not reloaded if blog.prefix is set #309

Closed nickbarnwell closed 7 years ago

nickbarnwell commented 8 years ago

gemfile.lock

GIT
  remote: https://github.com/andrusha/middleman-cloudfront.git
  revision: 7e1fd1e7134c4ab066027debbf41560d6144e452
  specs:
    middleman-cloudfront (0.2.1)
      fog-aws (~> 0.9)
      middleman-cli (>= 3.0)
      middleman-core (>= 3.0)

GIT
  remote: https://github.com/middleman/middleman.git
  revision: 07651c63a693bff183af907d274641d08f598565
  specs:
    middleman (4.1.10)
      coffee-script (~> 2.2)
      compass-import-once (= 1.0.5)
      haml (>= 4.0.5)
      kramdown (~> 1.2)
      middleman-cli (= 4.1.10)
      middleman-core (= 4.1.10)
      sass (>= 3.4.0, < 4.0)
    middleman-cli (4.1.10)
      thor (>= 0.17.0, < 2.0)
    middleman-core (4.1.10)
      activesupport (~> 5.0)
      addressable (~> 2.3)
      backports (~> 3.6)
      bundler (~> 1.1)
      contracts (~> 0.13.0)
      dotenv
      erubis
      execjs (~> 2.0)
      fast_blank
      fastimage (~> 2.0)
      hamster (~> 3.0)
      hashie (~> 3.4)
      i18n (~> 0.7.0)
      listen (~> 3.0.0)
      memoist (~> 0.14)
      padrino-helpers (~> 0.13.0)
      parallel
      rack (>= 1.4.5, < 2.0)
      sass (>= 3.4)
      servolux
      tilt (~> 1.4.1)
      uglifier (~> 3.0)

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (5.0.0.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.4.0)
    ansi (1.5.0)
    backports (3.6.8)
    builder (3.2.2)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    compass-import-once (1.0.5)
      sass (>= 3.2, < 3.5)
    concurrent-ruby (1.0.2)
    contracts (0.13.0)
    dotenv (2.1.1)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    erubis (2.7.0)
    eventmachine (1.2.0.1)
    excon (0.51.0)
    execjs (2.7.0)
    fast_blank (1.0.0)
    fastimage (2.0.0)
      addressable (~> 2)
    ffi (1.9.14)
    fog-aws (0.11.0)
      fog-core (~> 1.38)
      fog-json (~> 1.0)
      fog-xml (~> 0.1)
      ipaddress (~> 0.8)
    fog-core (1.42.0)
      builder
      excon (~> 0.49)
      formatador (~> 0.2)
    fog-json (1.0.2)
      fog-core (~> 1.0)
      multi_json (~> 1.10)
    fog-xml (0.1.2)
      fog-core
      nokogiri (~> 1.5, >= 1.5.11)
    formatador (0.2.5)
    haml (4.0.7)
      tilt
    hamster (3.0.0)
      concurrent-ruby (~> 1.0)
    hashie (3.4.4)
    htmlcompressor (0.2.0)
    http_parser.rb (0.6.0)
    i18n (0.7.0)
    ipaddress (0.8.3)
    kramdown (1.11.1)
    listen (3.0.8)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    map (6.6.0)
    memoist (0.14.0)
    middleman-blog (4.0.1)
      addressable (~> 2.3)
      middleman-core (>= 4.0.0)
      tzinfo (>= 0.3.0)
    middleman-livereload (3.4.6)
      em-websocket (~> 0.5.1)
      middleman-core (>= 3.3)
      rack-livereload (~> 0.3.15)
    middleman-minify-html (3.4.1)
      htmlcompressor (~> 0.2.0)
      middleman-core (>= 3.2)
    middleman-s3_sync (4.0.3)
      ansi (~> 1.5.0)
      fog-aws (>= 0.1.1)
      map
      middleman-cli
      middleman-core (>= 4.0.0)
      parallel
      ruby-progressbar
      unf
    middleman-sprockets (4.0.0)
      middleman-core (~> 4.0)
      sprockets (>= 3.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.9.0)
    multi_json (1.12.1)
    nokogiri (1.6.8)
      mini_portile2 (~> 2.1.0)
      pkg-config (~> 1.1.7)
    padrino-helpers (0.13.2)
      i18n (~> 0.6, >= 0.6.7)
      padrino-support (= 0.13.2)
      tilt (>= 1.4.1, < 3)
    padrino-support (0.13.2)
      activesupport (>= 3.1)
    parallel (1.9.0)
    pkg-config (1.1.7)
    rack (1.6.4)
    rack-livereload (0.3.16)
      rack
    rb-fsevent (0.9.7)
    rb-inotify (0.9.7)
      ffi (>= 0.5.0)
    redcarpet (3.3.4)
    ruby-progressbar (1.8.1)
    sass (3.4.22)
    servolux (0.12.0)
    sprockets (3.7.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    stamp (0.6.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (1.4.1)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.1)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.2)

PLATFORMS
  ruby

DEPENDENCIES
  builder
  middleman!
  middleman-blog
  middleman-cloudfront!
  middleman-livereload
  middleman-minify-html
  middleman-s3_sync
  middleman-sprockets (~> 4.0.0.rc)
  mime-types
  nokogiri
  redcarpet
  sass
  stamp

BUNDLED WITH
   1.12.5

config.rb

require 'sass'
require 'stamp'

###
# Page options, layouts, aliases and proxies
###

# Per-page layout changes:
# 
# With no layout
# page "/path/to/file.html", :layout => false
# 
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
# 
# A path which all have the same layout
# with_layout :admin do
#   page "/admin/*"
# end

# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
#   @which_fake_page = "Rendering a fake page with a variable"
# end

###
# Helpers
###

# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes

# Methods defined in the helpers block are available in templates
# helpers do
#   def some_helper
#     "Helping"
#   end
# end

activate :sprockets
sprockets.append_path 'last_ascent_styles'
set :css_dir, 'stylesheets'

set :js_dir, 'javascripts'

set :images_dir, 'images'

set :haml, { :ugly => true, :format => :html5 }

##################

Time.zone = "America/Los_Angeles"

set :markdown_engine, :redcarpet
set :markdown, 
    autolink:           true,
    fenced_code_blocks: true,
    no_intra_emphasis:  true,
    strikethrough:      true,
    tables:             true,
    quote:              true,
    smartypants:        true

page "/log/feed.xml", :layout => false
page "/feed.xml", :proxy => "/log/feed.xml", :layout => false

activate :blog do |blog|
  blog.prefix = "log"
  # blog.permalink = ":year/:month/:day/:title.html"
  blog.sources = "posts/:year-:month-:day-:title.html"
  # blog.taglink = "tags/:tag.html"
  blog.layout = "post"
  blog.summary_separator = /(READMORE)/
  # blog.summary_length = 250
  # blog.year_link = ":year.html"
  # blog.month_link = ":year/:month.html"
  # blog.day_link = ":year/:month/:day.html"
  blog.default_extension = ".md"

  blog.tag_template = "log/tag.html"
  blog.calendar_template = "log/calendar.html"

  blog.paginate = true
  blog.per_page = 10
  blog.page_link = "page/:num"
end

# Build-specific configuration
set :build_dir, 'build'

configure :build do
  # Minify static content
  activate :minify_css
  activate :minify_javascript
  activate :minify_html

  # Optimise Images

  # Enable cache buster
  # activate :cache_buster

  # Don't use relative URLs
  #activate :relative_assets
  activate :asset_hash

  # GZIP JS and CSS
  activate :gzip

  # Compress PNGs after build
  # First: gem install middleman-smusher
  # require "middleman-smusher"
  # activate :smusher

  # Or use a different image path
  # set :http_path, "/Content/images/"
end

activate :s3_sync do |s3|
  s3.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
  s3.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
  s3.bucket = '$REDACTED'
  s3.region = 'us-east-1'
  s3.after_build = false
end

default_caching_policy max_age:(60 * 60 * 24 * 365)
caching_policy 'text/html', max_age: 0, must_revalidate: true

activate :cloudfront do |config|
  config.access_key_id      = ENV['AWS_ACCESS_KEY_ID']
  config.secret_access_key  = ENV['AWS_SECRET_ACCESS_KEY']
  config.distribution_id    = ENV['LA_DISTRIBUTION_KEY']
  config.after_build        = false
end

configure :development do
  set :debug_assets, true
end

activate :livereload
activate :directory_indexes
nickbarnwell commented 8 years ago

Looks like anything except the default /blog is ignored - bizarre. Commenting out blog.prefix and changing blog.sources to log/… had changes no longer picked up and reloaded unless the server is restarted. Moving them to /blog and changing the corresponding line, and it works.

I could have sworn I'd seen a closed issue for this for earlier versions of Middleman that revolved around an inotify-fsevent bug, but I can't seem to find it again, and it should be long fixed on 10.10.

Branch with the issue here: https://github.com/nickbarnwell/last-ascent/tree/broken-blog-reloading

nickbarnwell commented 8 years ago

Scratch that, only ignored if the blog.prefix is literally log, probably related to a change in how changes from listen are picked up and dispatched. Will dig in and try and submit a patch to resolve.

iwarner commented 7 years ago

@nickbarnwell Thanks for digging - assume this is no longer an issue? Please re-open if it is.