question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define fonts destination

See original GitHub issue

Hi, Laravel-Mix copies my fonts from:

assets/fonts/sansfont/sans.woff2 to public/fonts/sans.woff2,

Igonres sansfont folder,I want copy to public/fonts/sansfont/sans.woff2

is there any way to define that?

Thank you

//fonts.scss

 @font-face {
    font-family: mySans;
    src:url('../fonts/sansfont/sans.woff2') format('woff2');
    font-style: normal;
    font-weight: 300;
  }
  .my-sans {
    font-family: mySans, Arial, Helvetica, sans-serif;
  }
//webpack.mix.js

let mix = require('laravel-mix');

mix.js('resources/assets/js/app.js', 'public/js')
  .sass('resources/assets/sass/app.scss', 'public/css')
  .browserSync({
    proxy: 'localhost:8000'
  });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
andrade1379commented, Dec 15, 2017

Currently I have both Bootstrap and Fontawesome fonts being built to /static/fonts/vendor/bootstrap and /static/fonts/vendor/fontawesome

Using:

.options({
        fileLoaderDirs: {
            fonts: 'static/fonts'
        }
    })

I have a font family within /resources/fonts/font-fam-folder and would also like to have the build place this directory within /static/fonts/vendor/font-fam-folder. Currently the build just moves all font files within the font-fam-folder in /static/fonts/. Is there something that I might have done wrong?

Example of my webpack.mix.js file:

mix.js('resources/js/app.js', 'static/js')
    .sass('resources/scss/app.scss', 'static/css')
    .copy('resources/language', 'static/language')
    .options({
        fileLoaderDirs: {
            fonts: 'static/fonts'
        }
    })
    .webpackConfig({
        plugins: [
            new CopyWebpackPlugin([{
                from: 'resources/images',
                to: 'static/images'
            }]),
            new ImageminPlugin({
                disable: process.env.NODE_ENV !== 'production', // Disable during development
                pngquant: {
                    quality: '95-100',
                },
                test: /\.(jpe?g|png|gif|svg)$/i,
            }),
            new ImageminPlugin({
                maxFileSize: 10000, // Only apply this one to files equal to or under 10kb
                jpegtran: { progressive: false }
            }),
            new ImageminPlugin({
                minFileSize: 10000, // Only apply this one to files over 10kb
                jpegtran: { progressive: true }
            })
        ]
    });

If I try to just .copy() I get the font files in /static/fonts/ as well as /static/fonts/font-fam-folder

0reactions
JeffreyWaycommented, Aug 28, 2017

If you need more control, can you just manually move the font files over? Or, there’s also mix.copy() to automate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How fonts give voice to a destination. - Monotype.
When exploring your next destination, take note of the typography you see guiding you through the place. How are the fonts connected to...
Read more >
Define fonts destination · Issue #1139 · laravel-mix ... - GitHub
Hi, Laravel-Mix copies my fonts from: assets/fonts/sansfont/sans.woff2 to public/fonts/sans.woff2, Igonres sansfont folder,I want copy to ...
Read more >
Defining Font Mappings
BI Publisher's Font Mapping feature enables you to map base fonts in RTF or PDF templates to target fonts to be used in...
Read more >
How to Install the Fonts You Want in Windows 10 - groovyPost
How to Install Fonts in Windows 10. Once you have your font downloaded (often .ttf files) and available, right-click it and click Install....
Read more >
Preview and apply fonts in Motion - Apple Support
You can choose a font before you enter text, or just start typing text and then modify the font later. You can preview...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found