Vaadin从14升级到23,在哪里放置@cssimport

发布于 2025-01-23 17:23:21 字数 1120 浏览 3 评论 0原文

我使用了Vaadin 14 Business Starter应用程序,该应用似乎已在Vaadin 23中停止。此应用程序将自定义CSS放在Mainlayout下:

@CssImport(value = "./styles/components/charts.css", themeFor = "vaadin-chart", include = "vaadin-chart-default-theme")
@CssImport(value = "./styles/components/floating-action-button.css", themeFor = "vaadin-button")
@CssImport(value = "./styles/components/grid.css", themeFor = "vaadin-grid")
@CssImport("./styles/lumo/border-radius.css")
@CssImport("./styles/lumo/icon-size.css")
@CssImport("./styles/lumo/margin.css")
@CssImport("./styles/lumo/padding.css")
@CssImport("./styles/lumo/shadow.css")
@CssImport("./styles/lumo/spacing.css")
@CssImport("./styles/lumo/typography.css")
@CssImport("./styles/misc/box-shadow-borders.css")
@CssImport(value = "./styles/styles.css", include = "lumo-badge")
@JsModule("@vaadin/vaadin-lumo-styles/badge")

这是否留在这里,还是将其与@pwa和其他注释一起移至AppConfig。 我之所以问,是因为菜单上的CSS样式被打破了,并且似乎不会改变它在Mainlayout或AppConfig上。

有什么想法吗?这是14至23之间的样式不兼容,还是对@cssimport的位置更改的要求?

还有其他人成功地将已停产的业务启动应用程序从14到23移植?

Vaadin Fold的一些帮助将不胜感激,因为这个业务启动器应用程序明确销售了获取专业订阅的收益,现在似乎已经被删除了。

I used the Vaadin 14 business starter app which appears to have been discontinued in Vaadin 23. This app put custom CSS under the MainLayout:

@CssImport(value = "./styles/components/charts.css", themeFor = "vaadin-chart", include = "vaadin-chart-default-theme")
@CssImport(value = "./styles/components/floating-action-button.css", themeFor = "vaadin-button")
@CssImport(value = "./styles/components/grid.css", themeFor = "vaadin-grid")
@CssImport("./styles/lumo/border-radius.css")
@CssImport("./styles/lumo/icon-size.css")
@CssImport("./styles/lumo/margin.css")
@CssImport("./styles/lumo/padding.css")
@CssImport("./styles/lumo/shadow.css")
@CssImport("./styles/lumo/spacing.css")
@CssImport("./styles/lumo/typography.css")
@CssImport("./styles/misc/box-shadow-borders.css")
@CssImport(value = "./styles/styles.css", include = "lumo-badge")
@JsModule("@vaadin/vaadin-lumo-styles/badge")

Does this stay here or does it move to AppConfig along with the @PWA and other annotations.
I ask because the CSS styling is broken on the menu and doesn't seem to change wither it is on MainLayout or AppConfig.

Any ideas? Is this a styling incompatibility between 14 and 23, or have the requirements on where to place the @CssImport changed?

Has anyone else successfully ported the discontinued business starter app from 14 to 23?

Some help from the Vaadin folk would be appreciated as this business starter app was a explicitly marketed benefit to getting a Pro subscription and now appears to have been dropped.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放赐 2025-01-30 17:23:21

当前推荐的方法是使用自定义主题文件夹(例如(例如) ,前端/主题/神话),然后将您的样式表放在那里。然后使用@theme(“ mytheme”)注释选择该主题。

./ styles/styles.css文件可能是主要主题样式表(frontend/themes/mytheme/styles.css.css)。所有其他没有themefor属性的所有其他@cssimports可以在同一文件夹上,并在主样式表中使用标准CSS @Import导入。

但是,由于Vaadin 23现在具有 lumo strieltion class ,您可能不需要那些其他样式表(例如,Margin.css)。但是,他们定义的CSS类名称可能不是较新的实用程序类别的1:1。

任何带有themefor属性的@cssimports都应放置在“特殊” 组件文件夹中,其中每个文件名与组件标签名称相对应(例如,fronandend /themes/my-theme/components/vaadin-chart.css)。

The currently recommended way is to use the custom theme folder (for example, frontend/themes/mytheme), and place your style sheets there. Then use the @Theme("mytheme") annotation to choose that theme.

The ./styles/styles.css file should likely be the main theme style sheet (frontend/themes/mytheme/styles.css). All other @CssImports without a themeFor attribute can be on the same folder, and imported in the main style sheet with the standard CSS @import.

But, since Vaadin 23 now has the Lumo utility classes built-in, you might not need those additional style sheets (for example, margin.css). Though, the CSS class names they define might not be 1:1 with the newer utility classes.

Any @CssImports with the themeFor attribute should be placed in the “special” components folder, where each file name corresponds to a component tag name (for example, frontend/themes/my-theme/components/vaadin-chart.css).

浪菊怪哟 2025-01-30 17:23:21

@cssimport的迁移手册。

但是有两件事要考虑(尽管被命名为“推荐更改”)...:

  1. “样式加载顺序”可能与以前不同,请查看 https://vaadin.com/docs/docs/latest/latest/ds/customization/customization/custom-theme/custom-theme/#样式加载订单
  2. 将您的CSS迁移到Vaadin 23不仅是交换注释。您必须做更多的事情,看看 https ://vaadin.com/docs/latest/upgrading/essential-steps/#update-your-css
  3. 错误的尺寸图标:在这里查看: vaadin迁移14至23:图标的大小不同(Viewbox错误?)

There's a migration manual for @CssImport at https://vaadin.com/docs/latest/upgrading/recommended-changes in chapter "Refactor Styles to a Custom Theme Folder".

But there are two things to consider (despite it is named "Recommended Changes")...:

  1. The "Style Loading Order" may be different than before, have a look at the list in https://vaadin.com/docs/latest/ds/customization/custom-theme/#style-loading-order
  2. Migrating your CSS to Vaadin 23 is not just exchanging an annotation. You have to do a lot more, have a look at https://vaadin.com/docs/latest/upgrading/essential-steps/#update-your-css
  3. Wrongly sized icons: have a look here: Vaadin migration 14 to 23: icons have different size (viewbox wrong?)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文