Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Fix Storybook Config
Browse files Browse the repository at this point in the history
  • Loading branch information
omega-takai committed Apr 29, 2020
1 parent ec3c1b6 commit 414afde
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 433 deletions.
6 changes: 5 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/**
* DOC: https://storybook.js.org/docs/configurations/default-config/#css-support
* DOC: https://webpack.js.org/concepts/loaders/#inline
*/
import { configure } from '@storybook/vue';

import '!style-loader!css-loader?sourceMap!sass-loader!../src/assets/style/global.scss';
import '!style-loader!css-loader?sourceMap!sass-loader?{"prependData":"@use \'./not-actual-styles\' as base;"}!../src/assets/style/global.scss';

// automatically import all files ending in *.story.js
configure(require.context('../src/components', true, /\.story\.js$/), module);
15 changes: 2 additions & 13 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const cssLoaderModule = {
},
},
}

const sassLoader = {
loader: 'sass-loader',
options: {
Expand All @@ -24,20 +25,10 @@ const sassLoader = {
sassOptions: {
fiber: require('fibers'),
},
prependData: "@use '@/assets/style/_not-actual-styles' as base;",
},
}

const sassResourcesLoader = {
loader: 'sass-resources-loader',
options: {
resources: [
path.resolve(__dirname, '../src/assets/style/_variables.scss'),
path.resolve(__dirname, '../src/assets/style/_mixins.scss'),
path.resolve(__dirname, '../src/assets/style/_functions.scss'),
]
}
}

// Export a function. Accept the base config as the only param.
// SEE: https://storybook.js.org/docs/configurations/custom-webpack-config/#full-control-mode
module.exports = async ({ config }) => {
Expand All @@ -57,15 +48,13 @@ module.exports = async ({ config }) => {
'vue-style-loader',
cssLoaderModule,
sassLoader,
sassResourcesLoader,
],
},
{
use: [
'vue-style-loader',
cssLoader,
sassLoader,
sassResourcesLoader,
],
},
],
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint:fix": "yarn lint:script --fix && yarn lint:style --fix",
"lint:script": "eslint --ext .js,.vue .",
"lint:style": "stylelint **/*.css **/*.scss **/*.vue",
"clean": "rimraf .nuxt dist .out public",
"clean": "rimraf .nuxt dist .out public coverage",
"test": "jest",
"style-migration": "sass-migrator --load-path node_modules module --verbose --migrate-deps",
"storybook": "start-storybook -c .storybook -p 6006",
Expand Down Expand Up @@ -72,7 +72,6 @@
"husky": "4.2.5",
"jest": "25.3.0",
"lint-staged": "10.1.7",
"node-sass": "4.13.1",
"prettier": "2.0.5",
"pug": "2.0.4",
"pug-plain-loader": "1.0.0",
Expand Down
Loading

0 comments on commit 414afde

Please sign in to comment.