module Awestruct

TODO: We could create our own installer and use that

in your site.yml specify

google_analytics:

account: UA-something
anonymizeIp: true
bounceTime: 15
demographics: true
linkAttribution: true

of course only “account” is required

Awestruct:Extensions:Minify is a transformer that minimizes JavaScript, CSS and HTML files. The transform runs on the rendered stream before it’s written to the output path.

Minification is performed by the following libraries:

uglifier (minifies javascript): http://github.com/lautis/uglifier
pngcrush (minifies PNG): http://pmt.sourceforge.net/pngcrush/

These commands must be available on your PATH in order to use them.

This class is loaded as a transformer into the Awestruct pipeline. The constructor accepts an array of symbols representing the file types to minimize.

transformer Awestruct::Extensions::Minify.new

This transform recognizes the following symbols:

:js - JavaScript files with extension .js
:html - HTML files with extension .html
:png - PNG files with extension .png

If no types are specified, the default value [:js] is used.

In addition to registering the transformer in the pipeline, it must be enabled by setting the following site property in _ext/config.yml:

minify: true

You can limit activation to one or more profiles:

profiles:
  production:
    minify: true

You can also configure the option arguments passed to the compressor programs. Here’s how you specify options arguments for the htmlcompressor command:

minify_html_opts:
  remove_intertag_spaces: true
  compress_js: true

Note that any hypen (-) must be represented as an underscore (_) in the configuration.

Constants

VERSION

Public Class Methods

yaml_load(str) click to toggle source
# File lib/awestruct/util/yaml_load.rb, line 4
def self.yaml_load(str)
  return YAML.load(str) unless YAML.method('load').parameters.any? {|k,v| v == :permitted_classes}
  YAML.load(str, permitted_classes: [Date, Symbol])  
end
yaml_load_file(str) click to toggle source
# File lib/awestruct/util/yaml_load.rb, line 9
def self.yaml_load_file(str)
  return YAML.load_file(str) unless YAML.method('load').parameters.any? {|k,v| v == :permitted_classes}
  YAML.load_file(str, permitted_classes: [Date, Symbol])
end