Skip to content

Commit

Permalink
feat(files): keep support for legacy .jade files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Jul 27, 2016
1 parent ea894a5 commit b75605e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"main": "lib/index",
"keywords": [
"pug",
"jade",
"metalsmith",
"plugin"
],
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ({ locals = {}, filters = {}, useMetadata = false } = {}
}

Object.keys(files).forEach(function (file) {
if (!/\.pug/.test(path.extname(file))) {
if (!/\.(pug|jade)/.test(path.extname(file))) {
return
}

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/main/src/legacy.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1 Hello World
16 changes: 15 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import rimraf from 'rimraf'
import { test } from 'tap'

test('metalsmith-jade', tap => {
tap.plan(8)
tap.plan(9)

tap.afterEach(done => rimraf('test/fixtures/*/build', done))

Expand All @@ -23,6 +23,20 @@ test('metalsmith-jade', tap => {
})
})

tap.test('should support .jade files', assert => {
assert.plan(2)

let smith = new Metalsmith('test/fixtures/main')

smith.use(pug())

smith.build(err => {
assert.equal(err, null)

fs.exists('test/fixtures/main/build/legacy.html', exists => assert.ok(exists))
})
})

tap.test('should pass options to pug', assert => {
assert.plan(3)

Expand Down

0 comments on commit b75605e

Please sign in to comment.