Skip to content
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

Detect CommonJS (.cjs) files #1511

Merged
merged 2 commits into from May 12, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rouge/lexers/javascript.rb
Expand Up @@ -15,7 +15,7 @@ class Javascript < RegexLexer

tag 'javascript'
aliases 'js'
filenames '*.js', '*.mjs'
filenames '*.cjs', '*.js', '*.mjs'
mimetypes 'application/javascript', 'application/x-javascript',
'text/javascript', 'text/x-javascript'

Expand Down
2 changes: 2 additions & 0 deletions spec/lexers/javascript_spec.rb
Expand Up @@ -17,7 +17,9 @@
include Support::Guessing

it 'guesses by filename' do
assert_guess :filename => 'foo.cjs'
assert_guess :filename => 'foo.js'
assert_guess :filename => 'foo.mjs'
end

it 'guesses by mimetype' do
Expand Down