我目前面临使用scss进行 Storybook React 的问题。我正在使用sb init创建故事书文件。一切正常,所有插件均已加载,但只有样式不起作用。如果我使用css文件,该样式将起作用。
@storybook/preset-scss我已经按照有关使用和配置的文档中的说明进行操作webpackFinal,但它仍然无法正常工作
这是故事书文件的示例
导入'./button.scss'; 无法正常工作
import React from 'react';
import PropTypes from 'prop-types';
import './button.scss'; -> this one not working
export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return (
<button
type="button"
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
style={backgroundColor && { backgroundColor }}
{...props}
>
{label}
</button>
);
};
Button.propTypes = {
primary: PropTypes.bool,
backgroundColor: PropTypes.string, …Run Code Online (Sandbox Code Playgroud)