React styleguidedist, сборка npx styleguidist не находит импорт файлов шрифтов в css - PullRequest
1 голос
/ 18 июня 2020

У меня проблема, когда я создаю руководство по стилю «npx styleguidist build», у меня этого не было, когда я запускаю «сервер npx styleguidist». В файле css, созданном сборкой styleguidist, ссылка на шрифты не совпадает с тем, что находится в папке сборки:

src:url(static/media/GothamRounded-Light.a6caeaca.woff2)

Это работает, если я заменяю этот URL-адрес в css созданном файле на:

src:url(../media/GothamRounded-Light.a6caeaca.woff2)

См. Дерево папок сборки: изображение папок сборки styleguidedist

styleguide.config. js:

const path = require('path')
const fs = require('fs');

module.exports = {
    require: [
        path.join(__dirname, 'src/assets/scss/app.scss'),
    ],
    updateExample(props, exampleFilePath) {
        const { settings, lang } = props
        if (settings && typeof settings.file === 'string') {
            const filepath = path.resolve(
                path.dirname(exampleFilePath),
                settings.file
            )
            const { file, ...restSettings } = settings
            return {
                content: fs.readFileSync(filepath, 'utf8'),
                settings: restSettings,
                lang
            }
        }
        return props
    },
    sections: [
        {
            name: 'UI Components',
            components: 'src/components/**/*.jsx',
            exampleMode: 'collapse', // 'hide' | 'collapse' | 'expand'
            usageMode: 'collapse', // 'hide' | 'collapse' | 'expand'
            collapseCode: true,
         }
    ],
}
...