rohanray / next-fonts

Import fonts in Next.js (supports woff, woff2, eot, ttf, otf & svg)
179 stars 12 forks source link

Option currying for consistency with the official next plugins #20

Open kachkaev opened 4 years ago

kachkaev commented 4 years ago

👋 @rohanray WDYT of changing the API of the plugin the following way?

 // next.config.js
 module.exports = require("next-compose-plugins")([
   require("@next/bundle-analyzer")({ enabled: true }),
   require("@zeit/next-source-maps")(),
-  [require("next-fonts"), { assetPrefix: 'https://example.com', enableSvg: true }],
+  require("next-fonts")({ prefix: 'https://example.com', enableSvg: true }),
])

This request is similar to https://github.com/martpie/next-transpile-modules/issues/52

I'd like to avoid pollution of the config object with plugin-specific options like enableSvg and also customize prefix for fonts only.

https://github.com/rohanray/next-fonts/blob/cf7165ceb6d9288abee47e5f0bb0db6a9625ade1/index.js#L12

 const assetPrefix = options.prefix !== undefined ? options.prefix : nextConfig.assetPrefix || ''; 
kachkaev commented 4 years ago

🏓 @rohanray 🙂

A issue request in next-transpile-modules has been successfully resolved: https://github.com/martpie/next-transpile-modules/issues/52

rohanray commented 4 years ago

@kachkaev : I will have a look this weekend. Thanks -RR