Skip to content

Commit

Permalink
Preserve alternate file extension. Resolves es128#6
Browse files Browse the repository at this point in the history
es128 committed Nov 20, 2013
1 parent 71f4daf commit 58b6ec5
Showing 4 changed files with 24 additions and 3 deletions.
10 changes: 9 additions & 1 deletion lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ module.exports =
_exclusion is path
else false
.map (path) ->
if extension and ".#{extension}" isnt sysPath.extname path
if extension and '' is sysPath.extname path
"#{path}.#{extension}"
else
path
@@ -51,6 +51,11 @@ module.exports =
else
sysPath.join parent, path

if extension
deps.forEach (path) ->
if ".#{extension}" isnt sysPath.extname path
deps.push "#{path}.#{extension}"

if prefix?
prefixed = []
deps.forEach (path) ->
9 changes: 8 additions & 1 deletion test/config.excludes.coffee
Original file line number Diff line number Diff line change
@@ -5,9 +5,16 @@ assert = require 'assert'
getFixturePath = (subPath) ->
path.join __dirname, 'fixtures', subPath

describe 'progeny', ->
it 'should preserve original file extensions', (done) ->
progeny() null, getFixturePath('altExtensions.jade'), (err, dependencies) ->
paths = (getFixturePath x for x in ['htmlPartial.html', 'htmlPartial.html.jade'])
assert.deepEqual dependencies, paths
do done

describe 'progeny configuration', ->
describe 'excluded file list', ->
progenyConfig =
progenyConfig =
rootPath: path.join __dirname, 'fixtures'
exclusion: [
/excludedDependencyOne/
1 change: 1 addition & 0 deletions test/fixtures/altExtensions.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include htmlPartial.html

0 comments on commit 58b6ec5

Please sign in to comment.