Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/philipbordallo/gulp-tumblr

Better tumblr theming with gulp
https://github.com/philipbordallo/gulp-tumblr

Last synced: about 6 hours ago
JSON representation

Better tumblr theming with gulp

Awesome Lists containing this project

README

        

# gulp-tumblr
> Better tumblr theming with gulp

## Install

With [**npm**](https://www.npmjs.com/package/gulp-tumblr):

```
npm install --save-dev gulp-tumblr
```

## Usage

```javascript
const gulp = require('gulp');
const tumblr = require('gulp-tumblr');

gulp.src(['./template.html'])
.pipe(tumblr.preview())
.pipe(gulp.dest('./export/'));
```

## Requirements

* A JSON file (`options.dataFile`) that has the variable data of what to show.

Example: _data.json_

```json
{
"Basic": {
"Title": "Demo Theme",
"MetaDescription": "This is a meta description",
"Description": "This is a description",
"BlogURL": "http://demo.tumblr.com/"
},
"Text": {
"Title": "An example post",
"Body": "

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam nisi lorem, pulvinar id, commodo feugiat, vehicula et, mauris. Aliquam mattis porta urna. Maecenas dui neque, rhoncus sed, vehicula vitae, auctor at, nisi. Aenean id massa ut lacus molestie porta. Curabitur sit amet quam id libero suscipit venenatis.

\n\t
    \n\t\t
  • Lorem ipsum dolor sit amet.
  • \n\t\t
  • Consectetuer adipiscing elit.
  • \n\t\t
  • Nam at tortor quis ipsum tempor aliquet.
  • \n\t
\n\t

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse sed ligula. Sed volutpat odio non turpis gravida luctus. Praesent elit pede, iaculis facilisis, vehicula mattis, tempus non, arcu.

\n\t
Donec placerat mauris commodo dolor. Nulla tincidunt. Nulla vitae augue.
\n\t

Suspendisse ac pede. Cras tincidunt pretium felis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque porttitor mi id felis. Maecenas nec augue. Praesent a quam pretium leo congue accumsan.

"
},
"Quote": {
"Quote": "It does not matter how slow you go so long as you do not stop.",
"Source": "Wisdom of Confucius",
"Length": "short",
"Tags": "wisdom"
}
}
```

* A main template file that contains [Tumblr variables and blocks](https://www.tumblr.com/docs/en/custom_themes) and will be streamed in.

Example: _template.html_

```html



{Title}

{block:Description}

{/block:Description}




{Title}


{Description}

{block:Quote}{/block:Quote}
{block:Text}{/block:Text}

```

* A directory (`options.postFolder`) with individual templates for each post type.

Example: _post/text.html_

```html

{block:Title}{Title}{/block:Title}
{Body}

```

Example: _post/quote.html_

```html



{Quote}


{block:Source}

{Source}
{/block:Source}

```

## API

### `.preview([options])`

Takes a file with [Tumblr variables and blocks](https://www.tumblr.com/docs/en/custom_themes) and streams out a compiled file with data taken from a JSON file and separate post files.

### `.build([options])`

Takes a file with [Tumblr variables and blocks](https://www.tumblr.com/docs/en/custom_themes) and streams out a compiled file with blocks from separate post files ready to be upload to Tumblr.

#### `options`

Type: `object`

#### `options.dataFile`

Type: `string`
Default: `'./data.json'`;

Location of json file that stores variable data.

#### `options.postFolder`

Type: `string`
Default: `'./post/'`;

Location of folder that holds individual post files.