# middleman-hashicorp **Repository Path**: mirrors_hashicorp/middleman-hashicorp ## Basic Information - **Project Name**: middleman-hashicorp - **Description**: HashiCorp's custom middleman extensions and common bundles - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README > **Note** > This repository is no longer maintained or in-use at HashiCorp. As of March 2023, the repository is archived. # HashiCorp Middleman Customizations A wrapper around [Middleman][] for HashiCorp's customizations. ## Table of Contents - [Installation](#installation) - [Usage](#usage) - [Customizations](#customizations) - [Publishing a new Release](#publishing-a-new-release) - [Contributing](#contributing) ## Installation Add this line to the Gemfile: ```ruby gem 'middleman-hashicorp', github: 'hashicorp/middleman-hashicorp' ``` And then run: ```shell $ bundle ``` ## Usage To generate a new site, follow the instructions in the [Middleman docs][]. Then add the following line to your `config.rb`: ```ruby activate :hashicorp ``` If you are a HashiCorp employee and are deploying a HashiCorp middleman site, you will probably need to set some options. Here is an example from Packer: ```ruby activate :hashicorp do |h| h.name = "packer" h.version = "0.7.0" h.github_slug = "hashicorp/terraform" # Disable fetching release information - this is useful for non-product site # or local development. h.releases_enabled = false # Disable some extensions h.minify_javascript = false end ``` Almost all other Middleman options may be removed from the `config.rb`. See a HashiCorp project for examples. Now just run: ```shell $ middleman server ``` and you are off running! ## Customizations ### Default Options * Syntax highlighting (via [middleman-syntax][]) is automatically enabled * Asset directories are organized like Rails: * `assets/stylesheets` * `assets/javascripts` * `assets/images` * `assets/fonts` * The Markdown engine is redcarpet (see the section below on Markdown customizations) * During development, live-reload is automatically enabled * During build, css, javascript and HTML are minified * During build, assets are hashed * During build, gzipped assets are also created ### IE Compatibility There are bundled things that make IE behave nicely. Include them like this: ```html ``` ### Inline SVGs Getting SVGs out of the asset pipeline and into the DOM can be hard, but not with the magic `inline_svg` helper! ```erb <%= inline_svg "my-asset.svg" %> ``` It supports configuring the class, height, width, and viewbox. ### Turbolinks Turbolinks highjack links on the same domain and use AJAX to dynamically update only the changed content. This is used by many popular sites, including GitHub. To enable turbolinks, include the javascript. ```js // assets/javascripts/application.js //= require turbolinks ``` ### Mobile Sidebar The mobile sidebar is displayed on mobile and small screens as a hamburger menu. It requires some additional markup and css for configuration. First, define the following variables in your scss: ```scss $sidebar-background-color $sidebar-link-color $sidebar-font-family $sidebar-font-weight $sidebar-font-size $sidebar-link-color-hover ``` Then include the scss scaffold: ```scss @import 'hashicorp/sidebar'; ``` Next, create some markup like this: ```html
``` Finally include the required javascript: ```js //= require hashicorp/sidebar ``` ### Mega Nav HashiCorp has a consistent mega-nav used across all project sites. This is insertable into any document using the following: ```erb <%= mega_nav :terraform %> ``` Additionally, you must import the CSS and Javascript: ```js // assets/javascripts/application.js //= require hashicorp/mega-nav ``` ```scss // assets/stylesheets/application.scss @import 'hashicorp/mega-nav'; ``` ### Helpers * `latest_version` - get the version specified in `config.rb` as `version`, but replicated here for use in views. ```ruby latest_version #=> "1.0.0" ``` * `system_icon` - use vendored image assets for a system icon ```ruby system_icon(:windows) #=> "Hey, you should know...
This is a really advanced topic!