Skip to content

Commit

Permalink
Presets/Prototyping: Fix conversion to dash-case for Twig functions
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Dec 15, 2021
1 parent 6ebbfa0 commit 018ac63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
18 changes: 4 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/webpack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
"glob": "^7.2.0",
"html-webpack-plugin": "^5.5.0",
"js-yaml-loader": "^1.2.2",
"kebab-case": "^1.0.1",
"lodash.merge": "^4.6.2",
"mini-css-extract-plugin": "^2.4.5",
"param-case": "^3.0.4",
"postcss": "^8.3.11",
"postcss-loader": "^6.2.0",
"postcss-preset-env": "^6.7.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/webpack-config/src/utils/Html.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Studio Meta
* @license https://github.com/studiometa/twig-toolkit/blob/master/LICENSE
*/
import toKebab from 'kebab-case';
import { paramCase } from 'param-case';

/**
* @typdef {string | Record<string, boolean> | Record<number, Classes>} Classes
Expand Down Expand Up @@ -78,7 +78,7 @@ export default class Html {
if (key === '_keys' || (typeof value === 'boolean' && !value) || value === '') {
continue;
}
renderedStyles.push(`${toKebab(key)}: ${value};`);
renderedStyles.push(`${paramCase(key)}: ${value};`);
}
return renderedStyles.join(' ');
}
Expand All @@ -101,7 +101,7 @@ export default class Html {
continue;
}

key = toKebab(key);
key = paramCase(key);
if (typeof value === 'boolean') {
if (value) {
renderedAttributes.push(key);
Expand Down

0 comments on commit 018ac63

Please sign in to comment.