![]() ![]() The set commands are there to configure different middleman settings, here to show where the various stylesheet, image, and css directories are.Īctivate :directory_indexes with enable pretty urls. This file is for having a custom domain on Github Pages, if that’s the sort of thing you are in to. html in the name, it would otherwise get ignored. Page "CNAME", layout: false says to move the file called CNAME over without wrapping in the main layout. html activate :directory_indexes # Automatic image dimensions on image_tag helper # activate :automatic_image_sizes # Easier bootstrap navbars activate :bootstrap_navbar configure :development do activate :livereload end # Build-specific configuration configure :build do # Any files you want to ignore: ignore '/admin/*' # For example, change the Compass output style for deployment activate :minify_css # Minify Javascript on build activate :minify_javascript # Enable cache buster activate :asset_hash # Use relative URLs activate :relative_assets end # This will push to the gh-pages branch of the repo, which will # host it on github pages (If this is a github repository) activate :deploy do | deploy | deploy. # For custom domains on github pages page "CNAME", layout : false set :css_dir, 'stylesheets' set :js_dir, 'javascripts' set :images_dir, 'images' # Better markdown support # set :markdown, :tables => true, :autolink => true, :gh_blockcode => true, :fenced_code_blocks => true # set :markdown_engine, :redcarpet # Turn this on if you want to make your url's prettier, without the. We can install other gems here to add different functionality. Gemfileīy default, middleman installs the middleman-livereload plugin, so in development mode any browers that have a page open with refresh when you save a file. This creates 4 files in the main directory, Gemfile and Gemfile.lock, which we know and love, config.rb which configures how middleman generates the site, and source which are the sourcefiles of the site. First thing is to install middleman:Ĭreate static_site/source/layouts/layout.erbĬreate static_site/source/stylesheets/all.cssĬreate static_site/source/stylesheets/normalize.cssĬreate static_site/source/javascripts/all.jsĬreate static_site/source/images/background.pngĬreate static_site/source/images/middleman.png Lets look at how to setup a basic middleman site with bootstrap-sass, haml, and bower. One of the problems with starting with Middleman is that there are so many places to start. ![]() Setting up a simple static site with Middleman In the node world Yeoman does something similar, but I personally have had poor luck getting Grunt to work reliably in practice. So you get all the benefits of using a robust system that works for Rails apps without having to learn a bunch more things. Middleman is written in Ruby, so it’s our familiar toolset, and unlike Jekyll it uses Sprockets, which is the same asset pipelining system that Rails uses. Middleman is a static site generator, which means that it takes a bunch of source files, does some stuff with it, and produces static HTML, CSS, Images, and Javascript that can be hosted on a basic server somewhere, including hosting on S3 or Github Pages so you don’t need to consider a server. Markdown for formatting large blogs of content.haml for writing html, since I don’t like closing tags.layouts and partials so I only need to set things up once.I make a lot of websites, and I have a certain toolkit that I use to build them. This article was published a while ago and may contain obsolete information! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |