diff options
author | Alexey Vasiliev <leopard.not.a@gmail.com> | 2018-04-03 20:45:24 +0300 |
---|---|---|
committer | Alexey Vasiliev <leopard.not.a@gmail.com> | 2018-04-27 15:57:40 +0300 |
commit | c9a20b1ceb4246ef8de1f76297e7ee2b7e1e23da (patch) | |
tree | c7d4ca2d1ca1ad8675d9a3156e559864f13cc622 /config.rb | |
parent | f0c997b0cf3a5bd2d96ce366b1f635c110207634 (diff) |
start new version
Diffstat (limited to 'config.rb')
-rw-r--r-- | config.rb | 133 |
1 files changed, 75 insertions, 58 deletions
@@ -1,80 +1,97 @@ # encoding: utf-8 Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 -### -proxy "/manifest.appcache", "/pages/manifest.appcache", layout: false -ignore "/pages/manifest.appcache" +# Activate and configure extensions +# https://middlemanapp.com/advanced/configuration/#configuring-extensions + +# activate :autoprefixer do |prefix| +# prefix.browsers = "last 2 versions" +# end + +# Layouts +# https://middlemanapp.com/basics/layouts/ + +# Per-page layout changes +page '/*.xml', layout: false +page '/*.json', layout: false +page '/*.txt', layout: false +page '/404.html', layout: false ### # Helpers ### -helpers do - def default_keywords_helper - "pgtune, postgresql, postgres, tuning, config, configuration, free, open source" - end - def default_description_helper - "PgTune - Tuning PostgreSQL config by your hardware" - end -end -set :css_dir, 'stylesheets' -set :js_dir, 'javascripts' -set :images_dir, 'images' +require "lib/pgtune_helpers" +helpers PgtuneHelpers + +assets_dir = ".tmp/dist" + +activate :external_pipeline, + name: :webpack, + command: build? ? + "rm -fr #{assets_dir}/* && NODE_ENV=production ./node_modules/.bin/webpack --bail" : + './node_modules/.bin/webpack --watch -d --color', + source: assets_dir, + latency: 1 + +# With alternative layout +# page '/path/to/file.html', layout: 'other_layout' + set :markdown_engine, :kramdown set :markdown, filter_html: false, fenced_code_blocks: true, smartypants: true -set :encoding, 'utf-8' +set :encoding, "utf-8" -activate :sprockets do |c| - c.expose_middleman_helpers = true -end +# Proxy pages +# https://middlemanapp.com/advanced/dynamic-pages/ -if defined?(RailsAssets) - RailsAssets.load_paths.each do |path| - sprockets.append_path path - end -end +# proxy( +# '/this-page-has-no-template.html', +# '/template-file.html', +# locals: { +# which_fake_page: 'Rendering a fake page with a local variable' +# }, +# ) -activate :autoprefixer do |config| - config.browsers = ['last 2 versions'] -end +# Helpers +# Methods defined in the helpers block are available in templates +# https://middlemanapp.com/basics/helper-methods/ + +# helpers do +# def some_helper +# 'Helping' +# end +# end # Build-specific configuration +# https://middlemanapp.com/advanced/configuration/#environment-specific-settings + +# configure :build do +# activate :minify_css +# activate :minify_javascript +# end + +set :images_dir, 'images' + +activate :gzip, exts: %w(.css .htm .html .js .svg .xhtml) + configure :build do - # For example, change the Compass output style for deployment - activate :minify_css - # Minify Javascript on build - activate :minify_javascript - # asset hash - activate :asset_hash # min html activate :minify_html - # favicons - activate :favicon_maker do |f| - f.template_dir = 'source/images/favicons' - f.output_dir = 'build/images/favicons' - f.icons = { - "favicon_base.png" => [ - { icon: "apple-touch-icon-152x152-precomposed.png", size: "152x152" }, - { icon: "apple-touch-icon-144x144-precomposed.png", size: "144x144" }, - { icon: "apple-touch-icon-120x120-precomposed.png", size: "120x120" }, - { icon: "apple-touch-icon-114x114-precomposed.png", size: "114x114" }, - { icon: "apple-touch-icon-76x76-precomposed.png", size: "76x76" }, - { icon: "apple-touch-icon-72x72-precomposed.png", size: "72x72" }, - { icon: "apple-touch-icon-60x60-precomposed.png", size: "60x60" }, - { icon: "apple-touch-icon-57x57-precomposed.png", size: "57x57" }, - { icon: "apple-touch-icon-precomposed.png", size: "57x57" }, - { icon: "apple-touch-icon.png", size: "57x57" }, - { icon: "favicon.png", size: "16x16" }, - { icon: "favicon.ico", size: "64x64,32x32,24x24,16x16" } - ] - } - end end -# deploy -activate :deploy do |deploy| - deploy.deploy_method = :git - deploy.branch = "gh-pages" - deploy.clean = true +activate :s3_sync do |s3_sync| + default_caching_policy public: true, max_age: (60 * 60 * 24 * 10) + + s3_sync.delete = true # We delete stray files by default. + s3_sync.after_build = false # We do not chain after the build step by default. + s3_sync.prefer_gzip = true + s3_sync.path_style = true + s3_sync.reduced_redundancy_storage = false + s3_sync.acl = 'public-read' + s3_sync.encryption = false + s3_sync.prefix = '' + s3_sync.version_bucket = false + s3_sync.index_document = 'index.html' + s3_sync.error_document = '404.html' end |