Not a developer? Go to MovableType.com

Plugin and Theme Directory

Theme Export v1.2.4

By Byrne Reese
Posted September 11, 2012, in MT Tags, Templates, Widgets.

Details

This plugin provides the ability to export a blog's templates as a theme. Users can export a blog's templates in one of two ways:

  • via the command line using the export-theme tool
  • via the MT administrative web interface

Theme Exporter is great to kick-start theme development based on an existing blog: it saves you the mundane effort of copy and pasting templates into text files and starts a config.yaml for you. However, note that the exported results likely need some additional love: you may want to take advantage of features from Config Assistant like Theme Options or static content deployment, or features of Theme Manager like the ability to supply documentation and preview images.

It should also be mentioned that this plugin also provides a simple API for managing and configuring your own theme export if you so wish. Consult the POD documentation for MT::Theme::Exporter, found in this plugin's lib directory.

Prerequisites

This plugin requires a newer version of the YAML::Tiny Perl module than is included with Movable Type. Included with this plugin (in the extlib/ folder) is a newer version of YAML::Tiny. Copy from the plugin archive extlib/YAML/Tiny.pm to $MT_HOME/extlib/YAML/Tiny.pm to update Movable Type's copy of this plugin. This is a required, non-optional step!

Installation

The installation is the same as the standard for most MT plugins. If you need help, please see The Ultimate Guide to Installing Movable Type Plugins

One important note is that this plugin should be installed into Movable Type's addons directory. Installing this plugin into any other directory might produce critical (but non-damaging) errors. So please be careful.

Upgrading? Take Note

Also be aware that if you are upgrading from a previous version, you should remove any copy of Config Assistant from your plugins directory if one is installed there.

Usage

Web Interface

Go to the Design menu and select Theme Dashboard, then select Customization. Click the "Export Theme" link.

A pop-up dialog will appear. Fill in the General Information and Designer Details that, then click Export. When finished, click the download link.

export-theme Command Line Tool

A tool to export a blog's templates as a template set.

Basic Usage

cd /PATH/TO/MT/
MT_HOME=`pwd` perl ./tools/export-theme --blog=1 --id="MyTemplateSet"

Options

The following options are available:

  • blog - (required) The Blog ID(s) to export templates from. When more than one blog ID is specified in a comma delimited list, the tool will output a theme for each blog.

  • id - The ID to be used for the creation of the resulting plugin. This is also used to determine the output directory for related files.

  • name - The name to be used for the creation of the resulting plugin. This is also used to determine the output directory for related files.

  • version - The version string to be used for the creation of the resulting plugin.

  • static - The path to the directory containing your mt-static files for this template set. It must be a relative path from your mt-static folder.

  • key - The MT::PluginData key of the resulting template set.

  • verbose - Show verbose messages.

  • dryrun - When set to true, the tool will not actually do anything. Rather it will output logging messages indicating what it would have done.

  • zip - When set to true, the tool will create a zip file of the resulting theme for you automatically.

Example

From the command line, one would type:

cd /PATH/TO/MT/
chmod a+x tools/export-theme
MT_HOME=`pwd` perl ./tools/export-theme --blog=1 --id=MySet \
            --name="My Template Set" --version=3 --out="template-sets"

This would result in the following directories being created:

/PATH/TO/MT/template-sets/
    MySet-3.0/
        plugins/
            MySet/
                config.yaml
                templates/*
        mt-static/
            plugins/
                MySet/*

You should then be able to zip up the MySet directory or simply install as you would install any other plugin.

Once installed you can use the "refresh blog templates" action in the sidebar of the the Manage Templates screen (Design > Templates). Once templates are refreshed, rebuild the blog.

Support

You can file bug reports in Github's Issues tool.

Compatibility

Movable Type versions: 4.3

License

Perl Artistic


Back

Byrne Reese

Byrne Reese was previously the Product Manager of Movable Type at Six Apart, where he had also held positions as the Manager of Platform Technology and Product Manager for TypePad. Byrne is a huge supporter of the Movable Type user and developer community. He dedicates much of his time to promoting and educating people about Movable Type as well as building the tools and plugins for Movable Type that are showcased on Majordojo. He contributes regularly to open source; and he is an advocate for open protocols and standards like Atom and OpenID.

Website: http://profile.typekey.com/byrnereese