From ffb425efc989fdaef6d810fdb0197852020b8394 Mon Sep 17 00:00:00 2001 From: Diyan Dimitrov Date: Wed, 24 Nov 2021 17:36:00 +0200 Subject: [PATCH 1/3] build(*): add css plugin for storybook --- .storybook/main.js | 8 ++++++++ .storybook/preview.js | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.storybook/main.js b/.storybook/main.js index cbdd05660..5c21fbd88 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,3 +1,11 @@ +const postCSS = require('rollup-plugin-postcss'); + module.exports = { stories: ['../dist/stories/**/*.stories.{js,md,mdx}'], + + rollupConfig(config) { + config.plugins.push(postCSS({ include: ['**/*.scss'], inject: false })); + + return config; + } }; diff --git a/.storybook/preview.js b/.storybook/preview.js index c312f977c..32b83867c 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -36,7 +36,9 @@ const getTheme = (themeName) => { const themeProvider = (Story, context) => { const theme = getTheme(context.globals.theme); - return html` + const htmlNoMin = html; + + return htmlNoMin` From c1a37fca2aca2f749f9543f1e3393ae1ea83965f Mon Sep 17 00:00:00 2001 From: Diyan Dimitrov Date: Wed, 24 Nov 2021 18:19:53 +0200 Subject: [PATCH 2/3] chore(*): add comment for a workaround --- .storybook/preview.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.storybook/preview.js b/.storybook/preview.js index 32b83867c..9f2f8f73f 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -36,12 +36,16 @@ const getTheme = (themeName) => { const themeProvider = (Story, context) => { const theme = getTheme(context.globals.theme); - const htmlNoMin = html; - return htmlNoMin` + // Workaround for https://github.com/cfware/babel-plugin-template-html-minifier/issues/56 + const htmlNoMin = html; + const styles = htmlNoMin` + `; + + return htmlNoMin` + ${styles} ${Story()} `; }; From 7adc656f0176515ba280666df93a7fcefdfaade2 Mon Sep 17 00:00:00 2001 From: Diyan Dimitrov Date: Wed, 24 Nov 2021 18:23:25 +0200 Subject: [PATCH 3/3] chore(*): replace htmlNoMin --- .storybook/preview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.storybook/preview.js b/.storybook/preview.js index 9f2f8f73f..114ec43e4 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -44,7 +44,7 @@ const themeProvider = (Story, context) => { ${theme.default} `; - return htmlNoMin` + return html` ${styles} ${Story()} `;