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

Multiple Extensions for a View Engine #26

Merged
merged 1 commit into from
May 20, 2024

Conversation

ItzNotABug
Copy link
Owner

A view engine can support multiple file types, example -

  1. HBS View Engine supports .hbs & .html files
  2. JSX View Engine supports .js, .jsx & .tsx files

Current implementations requires adding an engine for each extension which can be repetitive, this PR addresses that issue.


Previously -

express.engine('js', jsx.engine);
express.engine('jsx', jsx.engine);
express.engine('tsx', jsx.engine);

New Approach -

express.engine(['js', 'jsx', 'tsx'], jsx.engine);

@ItzNotABug ItzNotABug added the enhancement New feature or request label May 20, 2024
@ItzNotABug ItzNotABug self-assigned this May 20, 2024
@ItzNotABug ItzNotABug merged commit 89440f5 into dev May 20, 2024
1 check passed
@ItzNotABug ItzNotABug deleted the multiple-extensions-for-a-view-engine branch May 20, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant