NXT-15922: Fix less -> css transpile issue while 'enact transpile'#388
NXT-15922: Fix less -> css transpile issue while 'enact transpile'#388hong6316 wants to merge 2 commits into
Conversation
daniel-stoian-lgp
left a comment
There was a problem hiding this comment.
one suggestion. in case you agree with it, please also update the code comment accordingly
| const origParseString = Plugin.prototype.parseString; | ||
| Plugin.prototype.parseString = function (ruleNode, stringValues) { | ||
| const value = stringValues || ruleNode.value; | ||
| if (/calc\s*\(.*var\s*\(/.test(value)) return value; |
There was a problem hiding this comment.
Should we also handle situation when not using var() inside calc?
Examples:
@lime-panel-body-padding: @lime-panel-body-padding-top ~"calc(@{lime-panel-body-padding-right} - @{lime-component-spacing})"; was already handled --> padding: 0 calc(132px - var(--primitive-spacing-36));
@lime-panel-body-padding: @lime-panel-body-padding-top ~"calc(@{lime-panel-body-padding-right} - 36px)"; --> padding: 0 NaNrem - 36px);
| if (/calc\s*\(.*var\s*\(/.test(value)) return value; | |
| if (/calc\s*\(/.test(value)) return value; |
Examples with suggestion applied:
@lime-panel-body-padding: @lime-panel-body-padding-top ~"calc(@{lime-panel-body-padding-right} - @{lime-component-spacing})"; was already handled --> padding: 0 calc(132px - var(--primitive-spacing-36));
@lime-panel-body-padding: @lime-panel-body-padding-top ~"calc(@{lime-panel-body-padding-right} - 36px)"; --> padding: 0 calc(132px - 36px);
Checklist
Issue Resolved / Feature Added
Fix less -> css transpile issue while
enact transpileReproduction steps
Expect: css looks fine, and panel works fine.
Actual: css looks weird, and panel not works
※ It cannot be reproduced when linking limestone directly, just
npm install @enact/limestonecases※ If you intend to link, you can reproduce the issue by running
enact transpileon Limestone first.Resolution
Fixed an issue where information was missing from CSS files when executing the
enact transpilecommand in Limestone,by injecting monkey-patch at
LessPluginRi.prototype.installintranspile.js-> Fall-throughing calc()+var() pattern
Additional Considerations
Links
NXT-15922
Comments
Enact-DCO-1.0-Signed-off-by: Taeyoung Hong (taeyoung.hong@lge.com)