Giter Club home page Giter Club logo

mojolicious-plugin-export's Introduction

Build Status Coverage Status

NAME

Mojolicious::Plugin::Export - Export a Mojolicious website to static files

VERSION

version 0.008

SYNOPSIS

use Mojolicious::Lite;
get '/' => 'index';
get '/secret' => 'secret';
plugin Export => {
    pages => [qw( / /secret )],
};
app->start;

DESCRIPTION

Deploy a Mojolicious webapp to static files.

Configuration

Default values for the command's options can be specified in the configuration using one of Mojolicious's configuration plugins.

# myapp.conf
{
    export => {
        # Configure the default pages to export
        pages => [ '/', '/hidden' ],
        # The directory to export to
        to => '/var/www/html',
        # Rewrite URLs to include base directory
        base => '/',
    }
}

ATTRIBUTES

pages

The pages to export by default. This can be overridden by the arguments to "export".

# Add pages to export by default
push @{ $app->export->pages }, '/blog';

to

The path to export to by default.

base

The base URL, if URLs need to be rewritten.

quiet

If true, will not report every action taken by the plugin. Defaults to true.

METHODS

export

app->export->export( $override );

Export the site. $override is a hash reference to override the object attributes (keys are attribute names, values are the overridden value).

HELPERS

export

The export helper returns the Mojolicious::Plugin::Export object.

EVENTS

before_write

Emitted after all the content has been loaded and prepared for export. The event is given two arguments: The Mojolicious::Plugin::Export object and a hashref of paths mapped to content to be exported. The content can be either a Mojo::DOM object for HTML pages or the content to be exported. This event may modify the hashref or the DOM objects to change the content before it is written.

app->export->on( before_write => sub {
    my ( $export, $pages ) = @_;
    for my $path ( keys %$pages ) {
        my $content = $pages->{ $path };
        # ...
    }
} );

SEE ALSO

Mojolicious::Command::export, Mojolicious::Plugin::Export::Git, Mojolicious::Plugin

AUTHOR

Doug Bell [email protected]

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

mojolicious-plugin-export's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.