This is a base Middleman application. This sets all of the defaults that I'll generally set when building a new application on Middleman. Be sure to read all of the documentation to become familiar with Middleman before using this base setup.
gem install bundler
bundle install
Bower is used for JavaScript dependency management.
npm install -g bower # If you don't have it already.
bower install
Note: By default, Bower Components install to the default bower_components
directory at the root. You can change this, if you want, in the .bowerrc
file, but make sure to update the .gitignore
with your new directory.
Gulp is used for testing of compiled CSS and JavaScript. Also, it's there in case you want to use it for any additional build tasks.
npm install
Install Node/NPM, if you haven't already, otherwise the command will yell at you.
You run the application by starting the Middleman server:
middleman s
gulp # Runs both `gulp test-css` and `gulp test-js`
gulp test:css # Runs csscss and parker on application.css
gulp test:js # Runs jshint on application.js
To build the static files:
middleman build
Take a look at Middleman Library for some useful Middleman methods that you can include in helpers/custom_helpers.rb
.
If you don't want the helpers in a separate file, you can just add the following block inside of config.rb
for your helper methods:
helpers do
# Put your custom helpers here...
end
- Create a new file
Rakefile
at the root of your project, and paste the file from baseman-deploy. - Replace the
REPO_URL
with your repositorie's URL. This assumes that you have agh-pages
branch that is serving up your site. - You can now deploy by running
rake deploy
from your project's root.
Requirement: You'll need to have SSH access to your server.
- Create a new file
Rakefile
at the root of your project, and paste the file from baseman-deploy. - Replace the
SSH_LOGIN_PATH
with your own. - You can now deploy by running
rake deploy
from your project's root.
Note: There is a version for staging as well.
Another option is the middleman-deploy extension, which provides more deployment methods for rsync, ftp, sftp or git. Be sure to check it out!
Big hat tip to Arron Mabrey for the deploy scripts :)