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

🎨 refactor: Prevent Font Asset Hashing in Vite Config #3865

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

danny-avila
Copy link
Owner

Summary

  • Modified the assetFileNames function in the build.rollupOptions section of vite.config.ts.
  • Implemented a conditional statement to check for font file extensions (woff, woff2, eot, ttf, otf).
  • Set font assets to use the format 'assets/[name][extname]', preserving the original filename without a hash.
  • Maintained the existing hash-based naming convention for all other asset types.

Change Type

  • New feature (non-breaking change which adds functionality)

Testing

To test this change:

  1. Run a build of the client application using npm run build or equivalent command.
  2. Inspect the output directory, particularly the assets folder.
  3. Verify that font files are named without a hash (e.g., fontname.woff2) while other assets still include a hash.
  4. Test the application to ensure fonts are loading correctly and there are no regressions in asset loading.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

@danny-avila danny-avila merged commit 6936d00 into main Aug 30, 2024
1 check passed
@danny-avila danny-avila deleted the fix/font-cache branch August 30, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant