Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-metalsmith

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-metalsmith - npm Package Compare versions

Comparing version 0.2.0 to 0.2.2

32

lib/index.js

@@ -26,4 +26,6 @@ var through = require('through2');

var m = metalsmith(opts.root || process.cwd());
(opts.use || []).forEach(m.use);
var root = opts.root || process.cwd();
var m = metalsmith(root);
prepareMiddleware().forEach(m.use);
m.metadata(opts.metadata || {});

@@ -33,2 +35,7 @@

function prepareMiddleware() {
var use = opts.use || [];
return _.isFunction(use) ? [use] : use;
}
function transform(file, enc, cb) {

@@ -40,9 +47,5 @@ if (file.isStream()) {

if (file.isBuffer()) {
try {
var key = file.path.replace(file.base, '');
var contents = file.contents;
add(key, contents);
} catch (err) {
emitError(err);
}
var key = file.path.replace(file.base, '');
var contents = file.contents;
add(key, contents);
}

@@ -87,5 +90,12 @@

var parsed = JSON.parse(contents.toString());
var parsed = {};
try {
parsed = JSON.parse(contents.toString());
} catch (err) {
emitError(err);
}
if (!_.isPlainObject(parsed)) {
throw new Error('JSON file should contain a single root object.');
emitError('JSON file should contain a single root object.');
}

@@ -92,0 +102,0 @@

{
"name": "gulp-metalsmith",
"version": "0.2.0",
"version": "0.2.2",
"description": "Lightweight gulp plugin for Metalsmith",

@@ -8,3 +8,5 @@ "keywords": [

"gulp",
"gulpplugin"
"gulpplugin",
"static site",
"ssg"
],

@@ -11,0 +13,0 @@ "repository": "jelz/gulp-metalsmith",

@@ -90,2 +90,12 @@ var test = require('tape');

test('Accept a single middleware function', function (t) {
t.plan(1);
prepare('index.html', {
use: function () {
t.pass();
}
});
});
test('Add metadata from configuration options', function (t) {

@@ -92,0 +102,0 @@ t.plan(3);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc