Make website projects offline | Middleman static project
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
source
Gemfile
Gemfile.lock
README.md
config.rb
config.ru

README.md

offline-CDN

For those who work when web is unreachable.

Components

  • Middleman + blog
  • Compass
  • Bootstrap (scss)
  • Fontawesome
  • JQuery

Installation

Create a new project with the template:

$ middleman init -T mars228/offline-cdn MY_NEW_PROJECT

Usage

Collect what You need create and copy files to correspond folders (or create symlinks). Save all information in data/libraries.yml. (Check files and folder permissions!)

Create a static file with:

$ middleman build

Move (or copy) build site to destination location. Remeber to add needed information to Your http server! I'm using Apache, in my cdn.lh.conf:

# ----------------------------------------------------------------------
# CORS-enabled images (@crossorigin)
# ----------------------------------------------------------------------
<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
    # mod_headers, y u no match by Content-Type?!
    <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
      SetEnvIf Origin ":" IS_CORS
      Header set Access-Control-Allow-Origin "*" env=IS_CORS
    </FilesMatch>
  </IfModule>
</IfModule>

# ----------------------------------------------------------------------
# Webfont access + js
# ----------------------------------------------------------------------
<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Headers "authorization, origin, user-token, x-requested-with, content-type"
    Header set Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
  </FilesMatch>
</IfModule>