metalsmith-layouts
Advanced tools
Comparing version 1.5.4 to 1.6.4
@@ -0,1 +1,5 @@ | ||
1.6.4 - February 22, 2016 | ||
------------------------- | ||
* allow layout: false to override default template | ||
1.5.4 - February 14, 2016 | ||
@@ -2,0 +6,0 @@ ------------------------- |
@@ -33,8 +33,5 @@ /** | ||
// Only process files with a specified layout | ||
if(!data.layout && !def) { | ||
return false; | ||
} | ||
return true; | ||
// Only process files with a specified layout or default template. Allow the | ||
// default template to be cancelled by layout: false. | ||
return 'layout' in data ? data.layout : def; | ||
} |
@@ -6,3 +6,3 @@ { | ||
"repository": "git://github.com/superwolff/metalsmith-layouts.git", | ||
"version": "1.5.4", | ||
"version": "1.6.4", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "main": "lib/index.js", |
@@ -105,4 +105,6 @@ # metalsmith-layouts | ||
The default layout to use. Can be overridden with the `layout` key in each file's YAML frontmatter. If a `default` layout hasn't been specified, `metalsmith-layouts` will only process files with a `layout` option in their front-matter. Don't forget to specify the file extension. So this `metalsmith.json`: | ||
The default layout to use. Can be overridden with the `layout` key in each file's YAML frontmatter, by passing either a layout or `false`. Passing `false` will skip the file entirely. | ||
If a `default` layout has been specified, `metalsmith-layouts` will process all files unless a pattern has been passed. Don't forget to specify the default template's file extension. So this `metalsmith.json`: | ||
```json | ||
@@ -119,3 +121,3 @@ { | ||
Will apply the `default.html` layout to all files, unless specified otherwise in the frontmatter. | ||
Will apply the `default.html` layout to all files, unless overridden in the frontmatter. | ||
@@ -122,0 +124,0 @@ ### directory |
@@ -152,2 +152,14 @@ var assert = require('assert'); | ||
it('should ignore files with layout: false', function(done){ | ||
Metalsmith('test/fixtures/layout-false') | ||
.use(layouts({engine: 'handlebars', default: 'default.html'})) | ||
.build(function(err){ | ||
if (err) { | ||
return done(err); | ||
} | ||
equal('test/fixtures/layout-false/expected', 'test/fixtures/layout-false/build'); | ||
done(); | ||
}); | ||
}); | ||
it('should not change file extension by default', function(done) { | ||
@@ -154,0 +166,0 @@ Metalsmith('test/fixtures/rename-option-default') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256303
86
385
221