Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/config/resource-ext-by-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ var defaultExtensions = {};
// should contain same data as ./resource-type-by-ext
defaultExtensions[types.html] = [ '.html', '.htm' ];
defaultExtensions[types.css] = [ '.css' ];
defaultExtensions[types.js] = [ '.js' ];

module.exports = defaultExtensions;
3 changes: 2 additions & 1 deletion lib/config/resource-type-by-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ var types = require('./resource-types');
module.exports = {
'.html': types.html,
'.htm': types.html,
'.css': types.css
'.css': types.css,
'.js': types.js
};
3 changes: 2 additions & 1 deletion lib/config/resource-type-by-mime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ var types = require('./resource-types');

module.exports = {
'text/html': types.html,
'text/css': types.css
'text/css': types.css,
'text/javascript': types.js
};
3 changes: 2 additions & 1 deletion lib/config/resource-types.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var types = {
css: 'css',
html: 'html'
html: 'html',
js: 'js'
};

module.exports = types;
7 changes: 7 additions & 0 deletions test/unit/filename-generator/by-type-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ describe('FilenameGenerator: byType', function() {
filename.should.equalFileSystemPath('css.css');
});

it('should add missed extensions for js resources', function () {
var r = new Resource('http://example.com/js', '');
r.getType = sinon.stub().returns('js');
var filename = byTypeFilenameGenerator(r, {}, []);
filename.should.equalFileSystemPath('js.js');
});

it('should not add missed extensions for other resources', function () {
var r = new Resource('http://1.gravatar.com/avatar/4d63e4a045c7ff22accc33dc08442f86?s=140&d=%2Fwp-content%2Fuploads%2F2015%2F05%2FGood-JOb-150x150.jpg&r=g', '');
r.getType = sinon.stub().returns('home');
Expand Down