Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upEnsure _loaderHelpers registers actual filenames #24
Conversation
This comment has been minimized.
This comment has been minimized.
I don't believe that |
This comment has been minimized.
This comment has been minimized.
@jagoda, you're totally right, my bad. I noticed this as I disappointedly watched travis fail. I've updated with code that works in |
var offset = path.slice(-1) === Path.sep ? 0 : 1; | ||
var name = file.slice(path.length + offset, -3); | ||
var name = Path.basename(file); | ||
name = name.slice(0, -path.extname(name).length); |
This comment has been minimized.
This comment has been minimized.
jagoda
Apr 14, 2015
Contributor
I don't think that this will work correctly for helpers that are in subdirectories. Any reason to not use the original approach but just replace -3
with -Path.extname(file).length
?
Slicing a path by the last 3 characters works for two character extensions, e.g. `'.js'` or `'.cs'` but not for longer extensions (`'.es6'`, `'.javascript'`, `'.coffeescript'` for example). Using `Path.extname` will extract the proper extension from a path, which can then be used to determine the length of the extension proper, and thereby allowing helpers with longer extension names.
This comment has been minimized.
This comment has been minimized.
@jagoda amended. |
This comment has been minimized.
This comment has been minimized.
Cool. Looks good to me. |
This comment has been minimized.
This comment has been minimized.
@hueniverse I can has merge? |
This comment has been minimized.
This comment has been minimized.
@hueniverse I am happy to merge this if given the commit bit. |
Ensure _loaderHelpers registers actual filenames
keithamus commentedApr 12, 2015
Slicing a path by the last 3 characters works for two character extensions, e.g.
'.js'
or'.cs'
but not for longer extensions ('.es6'
for example).Using
Path.extname
will extract the proper extension name from a path, enabling support for files with long extensions.