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

There appears to be an issue with the option: formats #19

Open
Damien-Displayr opened this issue Sep 30, 2019 · 4 comments
Open

There appears to be an issue with the option: formats #19

Damien-Displayr opened this issue Sep 30, 2019 · 4 comments

Comments

@Damien-Displayr
Copy link

Damien-Displayr commented Sep 30, 2019

Hey,

I am trying to not rely on Google Fonts in Production and I am going to use your neat plugin to download the fonts I need. However, I t5hink I have stumbled upon a bug. Can you please confirm, or let me know what I am doing wrong. Thanks

plugins:[
    new GoogleFontsPlugin({
        fonts: [
            { 
                family: "Open Sans",
                variants: ["300", "300i", "400", "400i", "600", "600i", "700", "700i", "800", "800i"],
                subsets: ["latin"]
            }
        ],
        filename: "google-fonts.css",
        formats: ["ttf", "woff", "woff2", "eot"]
    })
]

This outputs a css file but all the formats I requested are absent. I just get woff2 version of the font. Different types work if they are the only format requested. Is there a work around?

Thanks,
Damien

@Damien-Displayr
Copy link
Author

Damien-Displayr commented Sep 30, 2019

This below, just results in the truetype fonts only:

new GoogleFontsPlugin({
    fonts: [
        { 
            family: "Open Sans",
            variants: ["300", "300i", "400", "400i", "600", "600i", "700", "700i", "800", "800i"]
        }
    ],
    encode: false,
    filename: "google-fonts.css",
    formats: ["woff2", "woff", "ttf", "eof"]
})

@SirPole
Copy link
Owner

SirPole commented Oct 6, 2019

Hello,

the plugin outputs each format to it's own file. This is controlled by the [name] substitution you can specify in the filename option. This is so your backend only serves to your clients the fonts they need and can use (e.g. by User-Agent)

I understand, that without encoding, you could just have one file and let the client download the files it needs and chooses by itself... What do you think is the best approach? Should this happen automatically when encoding is disabled or should there be another option like allInOne: true?

@Damien-Displayr
Copy link
Author

I think allInOne is a good idea. I think if we return the woff2 and the woff fonts browsers themselves will now which to use.

@braedon
Copy link

braedon commented Apr 17, 2020

Any progress on this issue? It'd be great to be able to generate a single @font-face entry for each family/variant, and have all the formats in a single src.

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

No branches or pull requests

3 participants