npm's pretty magical

    peak

    0.4.4 • Public • Published

    peak

    NPM version tests

    Peak is a node toolkit for developing and deploying Tumblr themes.

    • Write Tumblr themes with your favorite HTML, CSS, and JavaScript preprocessors; include Tumblr tags natively with language-friendly syntax.
    • Preview Tumblr themes in real-time with actual Tumblr content.
    • Deploy to Tumblr with one prompt in your command line.

    Installation

    via npm:

    $ npm install peak -g
    

    Usage

    1. Create a new peak project:
    $ peak new mytheme
    

    where mytheme is the path of the folder you'd like to create. Optionally, run peak new with flags to configure your project (see configuration options). 2. Change directory to mytheme and start the watcher:

    $ cd mytheme
    $ peak watch
    

    Run with --help or -h for options. 3. Write your Tumblr theme!

    • See the syntax docs for Peak's language-friendly syntax for incorporating Tumblr tags/blocks and more.
    • See the languages docs for supported template languages.
    1. Using a browser, navigate to localhost:1111.
    2. To deploy your theme to Tumblr, run peak deploy from your project's root folder.

    Syntax

    Peak includes language-agnostic syntax for incorporating Tumblr tags and blocks in HTML, CSS, and JavaScript along with Peak-specific tags to further simplify Tumblr development.

    Take, for example, this jade theme (see languages):

    doctype html
    html
      head
        title !(Title)
        // +(src: 'style.styl' media: 'all')
        // +(src: 'main.coffee')
      body
        img(src="@(images/peak.jpg)")
        // #(Posts)
        article
          h1 !(Title)
        // ##

    Peak includes custom syntax for:

    • Tumblr tags:

      !(Title)
    • Tumblr blocks:

      // #(Posts)
      // ##

    Peak also includes unique syntax for:

    • inlining a theme (HTML, CSS or JavaScript).

      <!-- +(src: 'style.styl' media: 'all') -->
      <!-- +(src: 'main.coffee') -->
    • applying base URLs to external assets specific to watching or deploying.

      <img src="@(images/peak.jpg)" />

    When watching the theme, Peak will render Tumblr tags and blocks with the specified blog's context, like so:

    <!DOCTYPE html>
    <html>
      <head>
        <title>Peak Blog</title>
        <style type="text/css" media="all">
        body {
          background: white;
        }
        </style> 
        <script type="text/javascript">
        (function() {
          alert('Hello World');
        }).call(this);
        </script> 
      </head>
      <body>
        <img src="http://my-s3-bucket.com/dev/images/peak.jpg" />
        <article>
          <h1>Post 1</h1>
        </article>
        <article>
          <h1>Post 2</h1>
        </article>
        <article>
          <h1>Post 3</h1>
        </article>
      </body>
    </html>

    However, on deploy, Peak will compile Tumblr tags in their standard syntax:

    <!DOCTYPE html>
    <html>
      <head>
        <title>{Title}</title>
        <style type="text/css" media="all">
        body {
          background: white;
        }
        </style> 
        <script type="text/javascript">
        (function() {
          alert('Hello World');
        }).call(this);
        </script> 
      </head>
      <body>
        <img src="http://my-s3-bucket.com/production/images/peak.jpg" />
        {block:Posts}
          <article>
            <h1>{Title}</h1>
          </article>
        {/block:Posts}
      </body>
    </html>

    For more, check out the Syntax docs.

    Documentation

    Issues

    • Certain Tumblr tags are incompatible with Peak as they're not part of Tumblr's public customize API.

    License & Contributing

    Install

    npm i peak

    DownloadsWeekly Downloads

    6

    Version

    0.4.4

    License

    MIT

    Last publish

    Collaborators

    • nporteschaikin