I'm trying to implement microfrontend with Vaadin 14. I've managed to accomplish a working version thanks to the Vaadin official documentation and various examples on github, using WebComponentExporter. However I cannot find any information about using css in these exported webcomponents. I've tried putting #CssImport everywhere, with no success.
I'm pretty much in the same situation as Stuart in this unanswered Vaadin forum question: https://vaadin.com/forum/thread/18466808/cssimport-when-using-component-exporter
Since that forum is now read only, I'm hoping to find a solution here.
Try follow this tutorial https://vaadin.com/docs/v14/flow/integrations/embedding/tutorial-webcomponent-theming:
Add #Theme annotation on top of your exporter class:
#Theme(themeFolder = "my-theme")
public class MyComponentExporter extends WebComponentExporter<MyComponent> {
// ...
}
Add styles.css to your ${project.root}/frontend/themes/my-theme/ and put there your styles which will apply to your component shadow DOM (to target the document DOM, place your styles in document.css), like this:
:host {
// MyComponent's background color to blue
background-color: blue;
}
I tested it with V14 + Vaadin Portlet + Liferay 7.3 and it works in both production and dev modes. Vaadin Portlets are based on embedded components, so it should work also for regular servlet-based Vaadin applications.
Try to compile with the production profile. The microfrontends examples do not comment on it but if you are not with the production profile they do not work, at least in my case.
Check that the webpack.config.js file is not filtering the css files.
Check that the css files are in the correct frontend folder.
Related
I don't use Bootstrap, but 1 thing made me use it.
The class collapse with certain button.
I have got more than 2 thousand line of CSS and when I linked and imported BOOTSTRAP, it started remaking all my styles. In another word, Bootstrap styles and My Own CSS styles are collapsing and making unusable and ugly UI.
The question is:
Can I include only style classes that I really need?
Googled :D
I have no XP in this situation...
Within the bootstrap documentation I have found that you can download the styles separately, selecting which ones you need
https://getbootstrap.com/docs/3.4/customize/#download
https://i.stack.imgur.com/PWl7H.png
https://i.stack.imgur.com/zFCoP.png
I am new to Vaadin and created a web application based on the Vaadin Dashboard theme. However, in my application I am using a VerticalSplitPanel but it does not show the splitter! It is impossible to resize the splitpanel.
After doing some research on the web, I found out that the Dashboard theme is limited in terms of styles of components since the theme only implements styles of components shown in the Dashboard demo application.
My question now is, is it possible to modify the Dashboard theme to allow styles for the splitpanel and thus allowing me to view the splitter? If yes, can someone give me a hint how and where I can do this (keep in mind I'm very new to vaadin!)
The dashboard demo is really a nice startup to get some ideas for your app but i wouldn't suggest to use it as template to start your development on.
If what you are looking for is the "graphic look and feel" know that this feel is natively present in the Valo theme. For reference you can browse the Valo-Demo project on github ( https://github.com/vaadin/valo-demo ): for exemple the left menu css styles are in the css of Valo, they are only modified in the dashboard demo.
If what you are interest in is the functionality of the "dashboard" page (there you see the sparks, the charts, notes and so on) keep in mind that is made with a CssLayout, which is a powerful way to make custom layouts but of course you have to work out everything.
Probably a SplitPanel inside this layout gets something overwritten or not everything is implemented in the css.
In the end you can try PortalLayout add-on in Vaadin directory to achieve something similar or add the missing styles by yourself.
Cheers.
I am playing around with Angular.dart as app framework and trying Twitters Bootstrap components and CSS for styling. I did run into an issue almost immediately, since Bootstrap does not seem to handle ShadowDOM, and Angular.dart uses the ShadowDOM for Components.
This would essentially mean I cant build Angular components with Bootstrap.js. Using Bootstrap components only requiring CSS works fine with applyAuthorStyles: true in NgComponent annotation.
Is there any way to also build angular.dart components using bootstrap js components?
/Cenk
Several things can be fixed using applyAuthorStyles: true but selectors that cross the shadowDOM boundary don't work. You would have to change Bootstrap's css.
applyAuthorStyles is deprecated or already removed
Here Feature Request: Add templates for NgDirectives or a NgComponent non-shadow dom option is also a discussion going on about this topic.
It mentions a ng-pseudo directive that should help solving this issue.
AFAIK ShadowDOM will be ported to AngularJS as well maybe this creates some ally and eventually an improvment.
Polymer (JS and Dart) have the same problem.
I just defined some forms in /lib/form/doctrine/ But the form elements currently don't have any CSS formatting.
Is there a default stylesheet that I can quickly copy/paste to style the forms, error messages, etc.?
It's not out of the box for Symfony but Blueprint CSS is a nice CSS framework, and when I used symfony 1.4, it used to color automatically the errors (I don't know if they changed the class names and stuff).
It's a bit heavy, but it ensures a solid structure if you use it for your development.
I just used Symfony's CSS from the admin. It was exactly what I was looking for - good results with minimal effort. Thanks for the suggestion cuhuak.
I am working on building a site and i'm trying to use jquery ui themes for as much of the styling as possible. and the jGrowl site says it can be theme rolled.
from the site:
Changes in 1.2.2
Notification can now be theme rolled for jQuery UI, special thanks to Jeff Chan!
there isn't really any explanation as to how and i searched far and wide for an explanation to no avail.
You do not need to do anything, simply include the jquery-ui css. There are example files included for different themes in the download