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

ENH - Update bundling and vendoring (JS) #1955

Merged
merged 22 commits into from
Sep 2, 2024
Merged

ENH - Update bundling and vendoring (JS) #1955

merged 22 commits into from
Sep 2, 2024

Conversation

trallard
Copy link
Collaborator

@trallard trallard commented Aug 16, 2024

This PR is an attempt to improve our approach to bundling theme assets.
As you go through the PR, you will notice some changes, such as:

  • Removal of duplicate imports (per Why is @import "variables/bootstrap"; imported twice? #1788)
  • Instead of copying Font Awesome files around, these are now vendored similarly to how we do with Bootstrap
  • There are also some optimisations which should help with performance (making the theme a bit snappier) and better bundling

Closes: #1613
Closes: #1788

@trallard trallard added kind: enhancement New feature or request tag: javascript Pull requests that update Javascript code labels Aug 16, 2024
package.json Show resolved Hide resolved
// Extracts CSS for each JS file that includes CSS
{ loader: MiniCssExtractPlugin.loader },
{
// Interprets `@import` and `url()` like `import/require()` and will resolve them
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed so that we can include FA directly in our stylesheets

Comment on lines 162 to 168
// Font vendoring and management - will separate FA and export the font files
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
generator: {
filename: 'vendor/fontawesome/webfonts/[name][ext]'
}
},],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replaces the previous approach where we copied the files from node_modules and instead resolves the import and extracts the font files to our vendor directory

Copy link

Coverage report

This PR does not seem to contain any modification to coverable code.

webpack.config.js Show resolved Hide resolved
@Carreau
Copy link
Collaborator

Carreau commented Aug 28, 2024

Looks good to me, restarted the test as the failure was unrelated, and likely due to a homebrew update.

@trallard
Copy link
Collaborator Author

trallard commented Sep 2, 2024

Thanks for the review @Carreau, since there do not seem to be any blockers, I will go ahead and merge 🚀

@trallard trallard changed the title Update bundling and vendoring (JS) ENH - Update bundling and vendoring (JS) Sep 2, 2024
@trallard trallard merged commit 75d12d4 into main Sep 2, 2024
29 checks passed
@trallard trallard deleted the trallard/webpack-5 branch September 2, 2024 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement New feature or request tag: javascript Pull requests that update Javascript code
Projects
None yet
2 participants