build: оптимизация CSS Modules#3318
Merged
inomdzhon merged 3 commits intofeat/3276/components_to_css_modulesfrom Oct 4, 2022
Merged
build: оптимизация CSS Modules#3318inomdzhon merged 3 commits intofeat/3276/components_to_css_modulesfrom
inomdzhon merged 3 commits intofeat/3276/components_to_css_modulesfrom
Conversation
Contributor
size-limit report 📦
|
Contributor
👀 Styleguide deployedSee the styleguide for this PR at https://vkcom.github.io/VKUI/pull/3318/ |
97463ef to
b2cd01e
Compare
60e6730 to
b8388db
Compare
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5febe66:
|
Contributor
SevereCloud
reviewed
Sep 29, 2022
b8388db to
27b9aad
Compare
Contributor
Contributor
Author
@SevereCloud поправил ✅ Спасибо 🙏 PS: ещё не запушил, пишу тесты для babel планина |
54328ac to
5343ccb
Compare
5343ccb to
5febe66
Compare
SevereCloud
approved these changes
Oct 3, 2022
3 tasks
This was referenced Oct 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Что было сделано?
babel-plugin-transform-css-modulesвместо babel-plugin-css-modules-transform (подробности см. НаписатьBabelплагин для обработки CSS Modules #3345).jsxRuntime– с переводом на CSS Modules он больше не нужен.babel-plugin-auto-importиbabel-plugin-module-resolver.Нюансы
(для начала надо ознакомиться с описанием задачи #3345)
1. Вычисляемые названия св-в
Дабы не править текущий код, сохранил возможность писать
Но чтобы это работало, надо обязательно оставлять начало строкой. Короче:
иначе плагин не сматчит класс.
2. Утилитарные функции в
/helpersРечь о:
getHoverClassName()getMouseClassName()getPlatformClassName()getSizeXClassName()getSizeYClassName()getViewHeightClassName()getViewWidthClassName()Опять же, чтобы не переписывать текущее решение, прошёлся по коду и сделал минимальные изменения (на примере,
getSizeYClassName()):В конечном итоге в сборке заменится строкой, а на проде функция конкатенирует
sizeY:TODO
1 и 2 это пока временная мера. В будущем надо переписать на мапы написанные руками, по типу:
или как-нибудь иначе.
Чеклист
README.mdдляpackages/babel-plugin-transform-css-modulesпод описание плагинаpackages/babel-plugin-transform-css-modulesBabelплагин для обработки CSS Modules #3345activeMode, добавляется подстрокаvkui#2442