layout-wrapper
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,4 @@ const wrap = require('gulp-wrap') | ||
const ref = '\nSee https://github.com/kt3k/layout-wrapper' | ||
/** | ||
@@ -19,2 +21,3 @@ * @param {object} options - The options | ||
options = options || {} | ||
const layoutDir = options.layout | ||
@@ -28,2 +31,6 @@ const engine = options.engine || 'lodash' | ||
if (typeof layoutDir === 'undefined') { | ||
throw new Error('`layout` option is required' + ref) | ||
} | ||
return wrap(data => { | ||
@@ -30,0 +37,0 @@ |
{ | ||
"name": "layout-wrapper", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Wrap the contents in the layout template. gulpfriendly.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test/test.js" | ||
"test": "tape test/test.js", | ||
"cov": "nyc --reporter=lcov npm test", | ||
"codecov": "npm run cov && codecov" | ||
}, | ||
@@ -32,2 +34,3 @@ "repository": { | ||
"devDependencies": { | ||
"codecov": "^1.0.1", | ||
"concat-stream": "^1.5.1", | ||
@@ -34,0 +37,0 @@ "gulp-front-matter": "^1.3.0", |
@@ -1,3 +0,4 @@ | ||
# layout-wrapper v1.0.0 | ||
# layout-wrapper v1.0.1 [![Circle CI](https://circleci.com/gh/kt3k/layout-wrapper.svg?style=svg)](https://circleci.com/gh/kt3k/layout-wrapper) [![codecov](https://codecov.io/gh/kt3k/layout-wrapper/branch/master/graph/badge.svg)](https://codecov.io/gh/kt3k/layout-wrapper) | ||
> Wrap the contents in the layout template. gulpfriendly. | ||
@@ -4,0 +5,0 @@ |
const wrapper = require('../') | ||
const test = require('tape') | ||
const Transform = require('stream').Transform | ||
const path = require('path') | ||
@@ -12,5 +11,5 @@ const concat = require('concat-stream') | ||
test('it returns a transform', t => { | ||
test('it returns a stream', t => { | ||
t.ok(typeof wrapper().pipe === 'function') | ||
t.ok(typeof wrapper({layout: ''}).pipe === 'function') | ||
@@ -21,2 +20,10 @@ t.end() | ||
test('it throws an error when the layout is not given', t => { | ||
t.throws(() => wrapper()) | ||
t.end() | ||
}) | ||
test('it wraps with the given template', t => { | ||
@@ -23,0 +30,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7151
12
60
87
7