小编ot9*_*954的帖子

如何在 angular 应用程序的故事书中加载全局 scss 文件?

我正在尝试在故事书中加载自定义全局样式文件 theme-default.scss 。虽然我的组件正在故事书中加载,但没有应用样式。我遵循了自定义 webpack 配置的本教程故事书官方文档。(虽然我对 webpack 不是很熟悉)

这是我的 .storybook/main.js 文件

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
//import '!style-loader!css-loader!../src/stories/stories.scss'; // for scss
module.exports = {
  stories: ['../src/**/*.stories.ts'],
  addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-notes'],
  webpackFinal: async (config, { configType }) => {
    // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
    // You can change the configuration based on that.
    // 'PRODUCTION' is used when building the static version of storybook.

    // Make whatever fine-grained changes you need
    config.module.rules.push({
      test: …
Run Code Online (Sandbox Code Playgroud)

sass typescript webpack angular storybook

11
推荐指数
1
解决办法
2214
查看次数

标签 统计

angular ×1

sass ×1

storybook ×1

typescript ×1

webpack ×1