-
-
Notifications
You must be signed in to change notification settings - Fork 292
Enable fileNameGenerator byType to read Javscript files by mimeType. Curr… #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ently code only enables CSS and HTML files by mimeType.
s0ph1e
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution 👍
Could you please add small test for js extension, like we have for css and html here
node-website-scraper/test/unit/filename-generator/by-type-test.js
Lines 27 to 40 in 798a0f0
| it('should add missed extensions for html resources', function () { | |
| var r = new Resource('http://example.com/about', ''); | |
| r.getType = sinon.stub().returns('html'); | |
| var filename = byTypeFilenameGenerator(r, {}, []); | |
| filename.should.equalFileSystemPath('about.html'); | |
| }); | |
| it('should add missed extensions for css resources', function () { | |
| var r = new Resource('http://example.com/css', ''); | |
| r.getType = sinon.stub().returns('css'); | |
| var filename = byTypeFilenameGenerator(r, {}, []); | |
| filename.should.equalFileSystemPath('css.css'); | |
| }); | |
lib/config/resource-type-by-ext.js
Outdated
| '.css': types.css | ||
| '.css': types.css, | ||
| '.js': types.js, | ||
| '.min.js': types.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe .min.js is not needed here, such files will have extension.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense..will get rid of this one. I was not sure, I added it to be double sure and cover all bases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I will add the test for .js files and push the code up. You should have a new commit/PR to approve soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s0ph1e : The updated code has been pushed and the new commit is in and ready for approval.
…yType FileNameGenerator
|
Thanks @ykhandor |
|
Released in version 3.3.5 |
Enable fileNameGenerator "byType" to read Javscript files by mimeType. Currently code only enables CSS and HTML files by mimeType.