contentful / contentful_middleman

Contentful Middleman is an extension to use the Middleman static site generator (Ruby) together with the API-driven Contentful CMS.
https://www.contentful.com
MIT License
146 stars 35 forks source link

space-hash causing build to fail #111

Closed joshRpowell closed 7 years ago

joshRpowell commented 7 years ago

using the experimental branch

running middleman contentful --rebuild with .[app]-site-hash present in root i get the following error: with site-hash

deleting the .[app]-site-hash from root allows the build to run without issue: without site-hash

any thoughts as to why the site-hash file would interfere with my webpack build?

here is my config.rb:

activate :directory_indexes
activate :autoprefixer

# Per-page layout changes:
#
# With no layout
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false

set :relative_links, true
set :relative_paths, true
set :css_dir, 'assets/stylesheets'
set :js_dir, 'assets/javascripts'
set :images_dir, 'assets/images'
set :fonts_dir, 'assets/fonts'
set :layout, 'layouts/app'
set :partials_dir, 'layouts/partials'

# Reload the browser automatically whenever files change
configure :development do
  activate :livereload
end

###########################
## Helpers
###########################
helpers do

  def render_partial( partial_name )
    partial "layouts/partials/#{partial_name}"
  end

end

activate :contentful do |f|
  f.access_token  = ENV['ACCESS_TOKEN']
  f.space         = { annuity_support: ENV['SPACE'] }
  f.content_types = { resource: 'resource' }
end

# Build-specific configuration
configure :build do
  activate :favicon_maker do |f|
    f.icons = {
      'favicon.png' => [
        { icon: 'favicon.png', size: '16x16' },
        { icon: 'favicon.ico', size: '64x64,32x32,24x24,16x16' }
      ]
    }
  end

  activate :relative_assets
  activate :gzip
  activate :minify_css
  activate :minify_html
  activate :minify_javascript
  activate :asset_hash
  activate :meta_tags
end

activate :deploy do |deploy|
  deploy.build_before = true
  deploy.deploy_method = :git
end

activate :external_pipeline,
         name: :webpack,
         command: build? ?
          './node_modules/webpack/bin/webpack.js --bail -p' :
          './node_modules/webpack/bin/webpack.js --watch -d --progress --color',
         source: '.tmp/dist',
         latency: 1
dlitvakb commented 7 years ago

Hey @joshRpowell,

As promised, a DEPLOYING file has been added to document platform specific issues.

It's currently being reviewed and will be merged ASAP.

https://github.com/contentful/contentful_middleman/pull/112

Cheers

dlitvakb commented 7 years ago

This has been merged.

Cheers

mrtnpro commented 7 years ago

@dlitvakb I don't really see how #112 was related to this issue. I'm having the same problem here: Apparently external_pipeline gets triggered when running bundle exec middleman contentful.

@joshRpowell were you able to fix this issue?

dlitvakb commented 7 years ago

Hey @crtvhd,

You should add the .*-site-hash to your .gitignore.

The idea of the DEPLOYING file, is to give users a chance to share deployment platform specific solutions, e.g. "When deploying on Netlify, do such and such to avoid seeing X". It "solves", this issue because this was a platform specific problem that @joshRpowell got to fix, and that's why this document was provided.

The document as of now is currently empty, but I'd love for @joshRpowell to share his solution.

Cheers

joshRpowell commented 7 years ago

@crtvhd I have a PR open for Netlify the DEPLOYING file.

when I need to update Contentful data I have to remove the site-hash

rm -r .*-space-hash

then run

middleman contentful --rebuild