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

metalsmith-layouts

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-layouts - npm Package Compare versions

Comparing version 1.6.5 to 1.7.0

5

History.md

@@ -0,1 +1,6 @@

1.7.0 - November 6, 2016
-------------------
* expose consolidate.requires fix (#18)
* check if paths are already absolute before joining the metalsmith path
1.6.5 - May 3, 2016

@@ -2,0 +7,0 @@ -------------------

10

lib/helpers/read-partials.js

@@ -16,10 +16,10 @@ /**

*
* @param {String} partialsRel
* @param {String} layoutsRel
* @param {String} partialsPath
* @param {String} layoutsPath
* @param {Object} metalsmith
* @return {Object}
*/
function readPartials(partialsRel, layoutsRel, metalsmith) {
var partialsAbs = path.join(metalsmith.path(), partialsRel);
var layoutsAbs = path.join(metalsmith.path(), layoutsRel);
function readPartials(partialsPath, layoutsPath, metalsmith) {
var partialsAbs = path.isAbsolute(partialsPath) ? partialsPath : path.join(metalsmith.path(), partialsPath);
var layoutsAbs = path.isAbsolute(layoutsPath) ? layoutsPath : path.join(metalsmith.path(), layoutsPath);
var files = read(partialsAbs);

@@ -26,0 +26,0 @@ var partials = {};

@@ -33,3 +33,4 @@ /**

'pattern',
'rename'
'rename',
'exposeConsolidate'
];

@@ -70,2 +71,6 @@

if (typeof opts.exposeConsolidate === 'function') {
opts.exposeConsolidate(consolidate.requires)
}
// Map options to local variables

@@ -72,0 +77,0 @@ var def = opts.default;

@@ -6,3 +6,3 @@ {

"repository": "git://github.com/superwolff/metalsmith-layouts.git",
"version": "1.6.5",
"version": "1.7.0",
"license": "MIT",

@@ -9,0 +9,0 @@ "main": "lib/index.js",

@@ -168,4 +168,4 @@ # metalsmith-layouts

"metalsmith-layouts": {
"engine": "swig",
"pattern": "*.md"
"engine": "handlebars",
"pattern": "**/*.hbs"
}

@@ -176,3 +176,4 @@ }

Would only process files that have the `.md` extension.
Would process all files that have the `.hbs` extension. Beware that the extensions might be changed by other plugins in the build chain, preventing the pattern from matching.
We use [multimatch](https://github.com/sindresorhus/multimatch) for the pattern matching.

@@ -186,3 +187,3 @@ ### rename

"plugins": {
"metalsmith-in-place": {
"metalsmith-layouts": {
"engine": "handlebars",

@@ -197,2 +198,18 @@ "rename": true

### exposeConsolidate
Not available over the `metalsmith.json` file.
Exposes Consolidate.requires as a function.
```js
// ...
.use(layout('swig', {
exposeConsolidate: function(requires) {
// your code here
}
}))
// ...
```
### Consolidate

@@ -199,0 +216,0 @@

@@ -43,2 +43,15 @@ var assert = require('assert');

it('should expose consolidate.requires', function(done){
Metalsmith('test/fixtures/basic')
.use(layouts({ engine: 'swig', exposeConsolidate: function(requires) {
assert.deepEqual(requires, require('consolidate').requires);
}}))
.build(function(err){
if (err) {
return done(err);
}
done();
});
});
it('should accept a default template', function(done){

@@ -144,2 +157,20 @@ Metalsmith('test/fixtures/default')

it('should find partials in subdirectories with absolute directory path', function(done){
var instance = Metalsmith('test/fixtures/partials-subdirectories')
.use(layouts({
engine: 'handlebars',
templates: __dirname + '/fixtures/partials-subdirectories/layouts',
partials: __dirname + '/fixtures/partials-subdirectories/layouts/partials'
}));
instance.build(function(err){
if (err) {
return done(err);
}
equal('test/fixtures/partials-subdirectories/expected', 'test/fixtures/partials-subdirectories/build');
done();
});
});
it('should accept a partials option', function(done){

@@ -146,0 +177,0 @@ Metalsmith('test/fixtures/partials-option')

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