Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 2.52 KB

README.md

File metadata and controls

46 lines (35 loc) · 2.52 KB

bildschirmfoto 2017-03-29 um 17 45 17

Middleman 4 + Webpack 2

A middleman v4 preconfigured to use the external pipeline with just webpack v2. Some helpful stuff is already integrated.

Features

Requirements

How to get started

(optional). Create yourself a .ruby-version and .ruby-gemset-file to not mess up your environment. I'd recommend to use rbenv to manage that environment. This has been tested with ruby version 2.3.3 and a gemset named middleman-webpack.

  1. gem install middleman

  2. Start a new middleman-project using

    $ middleman init my_new_site -T toadle/middleman-webpack
    

2b. middleman will run bundle install for you. So wait. 3. Run npm install. Wait. 4. Run middleman s. 5. You should be able to open the page at http://localhost:3000. 6. You can create a production-build by running middleman build. 7. Run tests by rake or rspec.

How does it work

  • Uses middleman's external pipeline to generate assets. Configuration is in the two environment-files development.rb and production.rb
  • Runs webpack as it's external pipeline, as configured in package.json.
  • webpack uses the the webpack.config.js as it's configuration.
  • When run as middleman s in development it'll start middleman, middleman-livereload, webpack and BrowserSync. So reloading of templates and JS/CSS-changes should be reflected without manual reloads.
  • BrowserSync is configured to proxy the middleman-server from localhost:4567 to localhost:3000 to inject itself.
  • Stuff webpack does is put into .webpack_build which middleman serves together with it's own files.