This is a demo project setup of Middleman (static site generator), Contentful (API based CMS) together with Webpack (Static module bundler).
- Homebrew
- Yarn
- Node 8.9.4 (preferably with NVM)
- Ruby 2.4.3 installed (preferably with RVM)
- Bundler gem
- Middleman gem
- Foreman gem
You will find a simplified installation instruction below for Homebrew, NVM, RVM and Ruby gems. I refer to each project documentation if any issues occurs during the setup. Ignore the first steps if you already have the requirements (Homebrew, Yarn, Node and Ruby) installed.
- Webpack dev middleware (bundles and serves files from webpack)
- Webpack hot middleware (hot module reloading, HMR)
- Bundle JS and SCSS files with webpack (overrides Middleman asset pipeline)
- Deployment with Heroku (Heroku CLI)
- Bourbon (Sass tool set) https://www.bourbon.io/
- Bourbon Neat (Sass grid) https://neat.bourbon.io/
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install yarn
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
nvm install 8.9.4
nvm use v8.9.4
node -v
\curl -sSL https://get.rvm.io | bash -s stable
rvm install 2.4.3
rvm use 2.4.3
ruby -v
gem install bundler
bundle install
gem install middleman
See the Middleman docs for more detailed instructions and help if you encounter problems during the install.
yarn run start
yarn run build
Rename .env.example
to .env
and enter your Contentful API credentials.
yarn run contentful
gem install foreman
foreman start
- Create Heroku account. Heroku homepage
- Install Heroku CLI.
heroku create example
heroku git:remote -a example
heroku buildpacks:set heroku/ruby
heroku buildpacks:add heroku/nodejs --index 1
heroku config:set CONTENTFUL_SPACE_ID=space_id
heroku config:set CONTENTFUL_ACCESS_TOKEN=access_token
You can also add your CONTENTFUL_SPACE_ID
and CONTENTFUL_ACCESS_TOKEN
under Settings > Config Variables
in your Heroku application.
yarn run deploy
or connect to GitHub under Deploy > Deployment method
and select your branch to do a manual deploy.
heroku open