styleguidist:build removes some HTML classes that are required for styling
See original GitHub issueCurrent behavior
Styleguide works great locally when spinning up the development server, but I notice that when I run styleguidist:build some of the HTML classes that are generated by styleguidist are not added to the final build resulting in some elements unstyled like the h1 of the Logo and the Prism.js code highlighting.
Development build
(class rsg--logo-49 exists on the h1 element)

(rsg--jssEditor-61 class and other classes exist to style the code example syntax highlighting)

Production Build
(class missing from h1)

(classes seem missing and code example is unstyled)

This is my styleguide.config.js
const config = {
theme: {
fontFamily: {
base: '"Matter", sans-serif',
},
color: {
base: '#544742',
sidebarBackground: '#fffbf7',
link: '#D14010',
linkHover: '#d14010bf',
},
sidebarWidth: 300,
borderRadius: 0,
},
styleguideDir: '../../public/styleguide',
// Code below can split page into sections
// Note you will need more than one section to show the section name in the sidebar
sections: [
{
name: 'Layout',
components: 'src/js/v3/Components/layout/*.vue',
},
{
name: 'Inputs',
components: 'src/js/v3/Components/utils/inputs/*.vue',
},
{
name: 'Cards',
components: 'src/js/v3/Components/cards/*.vue',
},
{
name: 'Notifications/Errors',
components: 'src/js/v3/Components/notifications/*.vue',
},
{
name: 'Lists',
components: 'src/js/v3/Components/lists/*.vue',
},
],
title: 'Felix Component Guide',
components: ['src/js/v3/Account/Components/*.vue', 'src/js/v3/Components/**/**/*.vue'],
webpackConfig: Object.assign({}, require('./webpack.config.js')),
copyCodeButton: true,
skipComponentsWithoutExample: true,
// Any assets you want to use need to be imported here and need appropriate webpack loaders
// Eventually this should be a separate file(s) or array of included assets
require: [
path.join(__dirname, './src/scss/app.scss'),
path.join(__dirname, '/assets/fonts/Matter-Regular.woff'),
path.join(__dirname, '/assets/fonts/Matter-Bold.woff'),
path.join(__dirname, '/assets/img/new/back arrow.svg'),
],
};
// Add additionnal font loader for font files
config.webpackConfig.module.rules.push({
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'themes/pillbox/assets/fonts/',
},
},
],
});
config.webpackConfig.module.rules.push({
test: /\.(png|jpe?g|gif|svg)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'themes/pillbox/assets/img/new/',
},
},
],
});
module.exports = config;
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cookbook - React Styleguidist
How to hide some components in style guide but make them available in ... As React removes all PropTypes in its production build,...
Read more >Change Styleguides output | Vue Styleguidist
Change Styleguides output. This page is meant to show how to customize a styleguide. It will get you to transform any part of...
Read more >styleguidist/styleguidist - Gitter
(specifically space which is exported from src/client/styles/theme.js ) ... Second question, how could I use propsParser option to ignore all classes props ...
Read more >vue-styleguidist | Yarn - Package Manager
... use webpack version to only remove when necessary (cdd8c84); try creating a release using lerna version (db9de67); use continue-on-error (5884599) ...
Read more >org.eclipse.opencert.elastic.app
You almost never need to update create-react-app itself: it delegates all the setup ... Button.css'; // Tell Webpack that Button.js uses these styles...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I tried to reproduce this issue without success. It is very probably due to the webpack configuration that styleguidist is using.
What framework/library/rendering tool are you using to build and render your library?
Nuxt? Quasar?
It could as well be a 3rd party webpack plugin like
purge-cssthat removes all the “unused” classes in production. If it’s the case, remove this plugin from your webpack config, for styleguidist, and everything should return to normal.setting
minimaze: falseinstyleguide.config.jsfixed issue