Skip to content

Commit

Permalink
fix: Suffix is misspelled
Browse files Browse the repository at this point in the history
Both versions (stripSufix and stripSuffix) are supported for backward-compatibility

Closes #56
  • Loading branch information
tawez committed Mar 25, 2015
1 parent 5acefb9 commit e7e20dd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function(config) {
ngHtml2JsPreprocessor: {
// strip this from the file path
stripPrefix: 'public/',
stripSufix: '.ext',
stripSuffix: '.ext',
// prepend this to the
prependPrefix: 'served/',

Expand Down
2 changes: 1 addition & 1 deletion lib/html2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var createHtml2JsPreprocessor = function(logger, basePath, config) {
var moduleName = config.moduleName;
var stripPrefix = new RegExp('^' + (config.stripPrefix || ''));
var prependPrefix = config.prependPrefix || '';
var stripSufix = new RegExp((config.stripSufix || '') + '$');
var stripSufix = new RegExp((config.stripSuffix || config.stripSufix || '') + '$');
var cacheIdFromPath = config && config.cacheIdFromPath || function(filepath) {
return prependPrefix + filepath.replace(stripPrefix, '').replace(stripSufix, '');
};
Expand Down
16 changes: 16 additions & 0 deletions test/html2js.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ describe 'preprocessors html2js', ->
done()


describe 'stripSuffix', ->
beforeEach ->
process = createPreprocessor stripSuffix: '.ext'

it 'strips the given suffix from the file path', (done) ->
file = new File 'file.html.ext'
HTML = '<html></html>'

process HTML, file, (processedContent) ->
expect(processedContent)
.to.defineModule('file.html').and
.to.defineTemplateId('file.html').and
.to.haveContent HTML
done()


describe 'stripSufix', ->
beforeEach ->
process = createPreprocessor stripSufix: '.ext'
Expand Down

0 comments on commit e7e20dd

Please sign in to comment.