storybook-css-modules
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -31,5 +31,12 @@ "use strict"; | ||
var defaultOptions = { | ||
importLoaders: 1, | ||
modules: { | ||
localIdentName: "[path][name]__[local]--[hash:base64:5]" | ||
"default": { | ||
importLoaders: 1, | ||
modules: { | ||
localIdentName: "[path][name]__[local]--[hash:base64:5]" | ||
} | ||
}, | ||
vue3: { | ||
modules: { | ||
localIdentName: "[path][name]__[local]--[hash:base64:5]" | ||
} | ||
} | ||
@@ -48,2 +55,3 @@ }; | ||
module, | ||
framework, | ||
_options$cssModulesLo, | ||
@@ -62,3 +70,4 @@ cssModulesLoaderOptions, | ||
_config$module = config.module, module = _config$module === void 0 ? {} : _config$module; | ||
_options$cssModulesLo = options.cssModulesLoaderOptions, cssModulesLoaderOptions = _options$cssModulesLo === void 0 ? defaultOptions : _options$cssModulesLo; | ||
framework = options.framework; | ||
_options$cssModulesLo = options.cssModulesLoaderOptions, cssModulesLoaderOptions = _options$cssModulesLo === void 0 ? defaultOptions[framework] || defaultOptions["default"] : _options$cssModulesLo; | ||
newConfig = _objectSpread(_objectSpread({}, config), {}, { | ||
@@ -74,3 +83,21 @@ module: _objectSpread(_objectSpread({}, module), {}, { | ||
}); | ||
_context.t0 = framework; | ||
_context.next = _context.t0 === "vue3" ? 10 : 12; | ||
break; | ||
case 10: | ||
cssLoaderRule.use = cssLoaderRule.use.map(function (item) { | ||
var _item$loader; | ||
if (item !== null && item !== void 0 && (_item$loader = item.loader) !== null && _item$loader !== void 0 && _item$loader.match(/[\/\\]css-loader/g)) { | ||
return _objectSpread(_objectSpread({}, item), {}, { | ||
options: _objectSpread(_objectSpread({}, item.options), cssModulesLoaderOptions) | ||
}); | ||
} | ||
return item; | ||
}); | ||
return _context.abrupt("break", 14); | ||
case 12: | ||
if (cssLoaderRule) { | ||
@@ -80,5 +107,5 @@ newConfig.module.rules.push(_objectSpread(_objectSpread({}, cssLoaderRule), {}, { | ||
use: cssLoaderRule.use.map(function (item) { | ||
var _item$loader; | ||
var _item$loader2; | ||
if (item !== null && item !== void 0 && (_item$loader = item.loader) !== null && _item$loader !== void 0 && _item$loader.match(/[\/\\]css-loader/g)) { | ||
if (item !== null && item !== void 0 && (_item$loader2 = item.loader) !== null && _item$loader2 !== void 0 && _item$loader2.match(/[\/\\]css-loader/g)) { | ||
return _objectSpread(_objectSpread({}, item), {}, { | ||
@@ -95,5 +122,8 @@ options: _objectSpread(_objectSpread({}, item.options), cssModulesLoaderOptions) | ||
return _context.abrupt("break", 14); | ||
case 14: | ||
return _context.abrupt("return", newConfig); | ||
case 8: | ||
case 15: | ||
case "end": | ||
@@ -100,0 +130,0 @@ return _context.stop(); |
{ | ||
"name": "storybook-css-modules", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Storybook CSS Modules preset", | ||
@@ -61,3 +61,5 @@ "author": "prototypearea", | ||
"supportedFrameworks": [ | ||
"react" | ||
"react", | ||
"preact", | ||
"vue3" | ||
], | ||
@@ -64,0 +66,0 @@ "icon": "https://raw.githubusercontent.com/prototypearea/storybook-css-modules/main/logo-css-modules.png" |
@@ -120,2 +120,10 @@ # Storybook CSS Modules preset · [![npm package](https://img.shields.io/npm/v/storybook-css-modules?color=green&label=npm&style=flat-square)](https://www.npmjs.com/package/storybook-css-modules) | ||
} | ||
``` | ||
``` | ||
<br /> | ||
## Examples | ||
- [React](https://github.com/prototypearea/storybook-css-modules/tree/main/examples/react) | ||
- [Preact](https://github.com/prototypearea/storybook-css-modules/tree/main/examples/preact) | ||
- [Vue 3](https://github.com/prototypearea/storybook-css-modules/tree/main/examples/vue3) |
11201
117
128