Module: Awestruct

Defined in:
lib/awestruct/extensions/minify.rb,
lib/awestruct/site.rb,
lib/awestruct/config.rb,
lib/awestruct/engine.rb,
lib/awestruct/erbable.rb,
lib/awestruct/version.rb,
lib/awestruct/erb_file.rb,
lib/awestruct/hamlable.rb,
lib/awestruct/haml_file.rb,
lib/awestruct/sass_file.rb,
lib/awestruct/scss_file.rb,
lib/awestruct/renderable.rb,
lib/awestruct/textilable.rb,
lib/awestruct/orgmodeable.rb,
lib/awestruct/asciidocable.rb,
lib/awestruct/markdownable.rb,
lib/awestruct/orgmode_file.rb,
lib/awestruct/textile_file.rb,
lib/awestruct/asciidoc_file.rb,
lib/awestruct/commands/init.rb,
lib/awestruct/markdown_file.rb,
lib/awestruct/verbatim_file.rb,
lib/awestruct/context_helper.rb,
lib/awestruct/commands/deploy.rb,
lib/awestruct/commands/server.rb,
lib/awestruct/extensions/gsub.rb,
lib/awestruct/renderable_file.rb,
lib/awestruct/extensions/posts.rb,
lib/awestruct/commands/generate.rb,
lib/awestruct/extensions/assets.rb,
lib/awestruct/extensions/disqus.rb,
lib/awestruct/extensions/flattr.rb,
lib/awestruct/extensions/tagger.rb,
lib/awestruct/front_matter_file.rb,
lib/awestruct/extensions/partial.rb,
lib/awestruct/extensions/sitemap.rb,
lib/awestruct/extensions/atomizer.rb,
lib/awestruct/extensions/data_dir.rb,
lib/awestruct/extensions/pipeline.rb,
lib/awestruct/extensions/relative.rb,
lib/awestruct/extensions/obfuscate.rb,
lib/awestruct/extensions/paginator.rb,
lib/awestruct/extensions/tag_cloud.rb,
lib/awestruct/restructuredtextable.rb,
lib/awestruct/extensions/indexifier.rb,
lib/awestruct/restructuredtext_file.rb,
lib/awestruct/commands/git_hub_pages.rb,
lib/awestruct/extensions/cachebuster.rb,
lib/awestruct/extensions/remotePartial.rb,
lib/awestruct/extensions/intense_debate.rb,
lib/awestruct/extensions/google_analytics.rb,
lib/awestruct/commands/manifest.rb,
lib/awestruct/sassable.rb

Overview

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 three libraries:

htmlcompressor (minifies HTML): http://code.google.com/p/htmlcompressor/
yuicompressor (minifies JavaScript and CSS): http://developer.yahoo.com/yui/compressor/
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 in the Awestruct pipeline. The constructor accepts an array of symbols representing the file types to minimize.

extension Awestruct::Extensions::Minify.new

This transform recognizes the following symbols:

:css - CSS files with extension .css
: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 [:css, :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
  compress_css: true

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

Defined Under Namespace

Modules: AsciiDocable, Commands, ContextHelper, Erbable, Extensions, Hamlable, Markdownable, Orgmodeable, ReStructuredTextable, Sassable, Textilable Classes: AsciiDocFile, Config, Engine, ErbFile, FrontMatterFile, HamlFile, MarkdownFile, OrgmodeFile, ReStructuredTextFile, Renderable, RenderableFile, SassFile, ScssFile, Site, TextileFile, VerbatimFile

Constant Summary collapse

VERSION =
'0.2.18'