-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular Layout Migration Guides #1426
Comments
Our layout needs, I feel, are pretty straightforward. We're almost exclusively using the fx directives (e.g. Also, really sorry to see this close down. Appreciate all your hard work over the years keeping it alive. |
It's sad to see this library go away when it was clearly very good! 😕 For me I have no idea where to migrate and what would be even the benefits, but I foresee it to be a very big pain. Our app has ~370 Components and counting and ~4700 attributes in the templates (and we have 3 of those apps). We heavily use But Thanks a lot @CaerusKaru for all your time and dedication maintaining this library. It has been extremely helpful! |
Sad to see this project close own :( We are using flex-layout heavily in one big and several smaller apps. We use this library in our large app ~1.200 times Thank you for your work on this library and thank you for the planned transition/shut-down period 👍 |
So so so so so sad. This project is fantastic, I can't believe it comes to an end... I'm not very okay with using tailwind, I hope someone would like to continue to maintain flex layout. Anyway thanks for everything @CaerusKaru, the job you have done so far is great :) |
We have a huge app with about 900 directives from this project. Mostly these directives:
|
I know that the angular team have their thoughts about the web standar but this library offers more than just alternative for css , it makes the flex and grid hell( joke) more easy to implement and it provides some directives for breakpoints i mean, its a bit agressive to declare a library -that is commonly used for a bunch of teams in their productions projects- as deprecated, i think that we can keep those directives and other stuff that the library offers ( breakpoints and declarative simplicity on flex grid) and incorporate as default in the framework, that can give angular more unique identity instead to make it more like react. |
I started giving (unwillingly) a try to Tailwind CSS. And I was quite surprised as it is not a bad experience at all. I found a guide here to help migrate from Flex Layout to Tailwind and it's pretty straight forward. Also, for people using VS Code I recommend getting the Tailwind CSS IntelliSense extension. It is quite useful. In a nutshell it is this:
|
Just now seeing this. This is upsetting news to say the least. I built an entire JsonSchema/ui-schema based platform around angular flex for one of the biggest hospital chains in the country, which only works because of the way angular flex works (using the directives). There really is no alternative that I am aware of. Have you all considered handing the project off to the community to maintain? Or is the issue some necessary collaboration with the angular team? |
Using tailwind is pointless to me. I personally prefer to write few css lines eventually coupled with CDK layout API than over weight my project with a css framework built for people unable to actually write CSS by themself. I agree with the previous post, if this lib should be maintained by the community it would be fantastic |
I've successfully migrated from flex-layout (~200 usages) to CSS Flexbox + CSS Grid + Angular CDK layout (without Tailwind). Here are the replacements I made, in case they are helpful to others. fxLayout="row", fxLayout="col"
// Flex row/col + grid.
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.grid { display: grid; }
// Flex-wrap utils.
.flex-wrap { flex-wrap: wrap; } // Mostly used with flex-row, when wrapping is desired.
.flex-col-xs { @media screen and (max-width: 599px) { flex-direction: column; } } // Switch from flex-row to flex-col on mobile. fxLayoutGap
// Gap.
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; } fxLayoutAlign
// Justify content.
.space-between { justify-content: space-between; } // Used very often with flex-row.
.justify-center { justify-content: center; } // Used to center something via flexbox.
// Align items. (Naming inspiration: https://tailwindcss.com/docs/align-items.)
.items-center { align-items: center; } // Used very often with flex-row. fxFlex
// Flex/grow/shrink properties https://developer.mozilla.org/en-US/docs/Web/CSS/flex.
.flex-1 { flex: 1 } // Same as flex: 1 1 0 (grow, shrink, basis 0). Has similar effect to width: 100%;
.flex-grow { flex-grow: 1; } // Same as flex: 1 1 auto (grow, shrink, basis auto). For spacer, etc. fxHide, fxShow
// Hide & show for different breakpoints.
.hide-xs { @media screen and (max-width: 599px) { display: none; } } // Hide on mobile.
.hide-gt-xs { @media screen and (min-width: 600px) { display: none; } } // Show only on mobile. Hide on desktop.
.hide-sm { @media screen and (max-width: 959px) { display: none; } } // Hide on mobile/tablet.
.hide-gt-sm { @media screen and (min-width: 960px) { display: none; } } // Show only on mobile/tablet. Hide on desktop. gdColumns
ngStyle.xs, ngClass.xsThese are the most challenging to replace - they're one of the nicest features of the flex-layout library. .my-div {
width: 100px;
@media screen and (max-width: 599px) {
width: 50px; // Smaller on mobile.
}
}
MediaObserverReplaced with Angular CDK Layout's BreakpointObserver (which felt faster to me in run-time). const isMobile: Observable<boolean> = this.mediaObserver.asObservable().pipe(
map((changes: MediaChange[]) => changes.some(change => change.mqAlias === 'xs'))); After: const isMobile: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.XSmall).pipe(
map(state => state.matches)); |
@anisabboud this is great. Thanks. Just a note though, |
i think that he talk about de .sm .xs after the ngStyle or ngClass |
Ah, gotcha. Fair enough |
Indeed, I was referring to ngStyle.xs & ngClass.xs, etc. (with breakpoints). |
Really sad and disappointed to see this library be deprecated. Like many others here, we have used and depended on flex-layout heavily over the years and it's a core part of every component we have ever written. I see migrating all of that to other alternatives like Tailwind to be a huge, non-trivial, undertaking. This was a great library and we're truly grateful to all the maintainers who have done such a wonderful job over the years. Please consider handing it over to the community instead of a complete deprecation. Here is our usage statistics: We are using flex-layout heavily across 4 production apps. We mainly use the flex-layout directives with breakpoints in all the apps. Total usage statistics: 7,309 times across 352 components Here's the breakdown by directive: |
By reading Angular blog, I found this issue. We have been using this lib for years and it works really good, thank you for your efforts to support it for such a long time! But it's really sad this lib is going to the end of its lifecycle. We are heavily using below directives with different breakpoints: I agree with @coreConvention's comments above, please consider hand over this project to the community. |
@anisabboud I had a similar idea.
is not the same thing. |
What about using Bootstrap's grid system + angular material components? (Only bootstrap grid and not other ones like ui components of bootstrap) |
Please consider handing over this project to the community. This project is so good. We can use directives instead of classes. Directives makes code easy to maintain and understand since different directives handle different things. (It is not full code ofcourse it is just an example.) which makes code easy to understand since class attribute is less bloated. |
This comment was marked as off-topic.
This comment was marked as off-topic.
First and foremost, thank you to everyone who has so far shared a solution that has worked for them. This kind of upstreaming and knowledge sharing is crucial to a smooth transition, and is a benefit to all. Sincerely, thank you. Second, in response to a few comments about "handing off to the community": I am totally ok with anyone forking this package under a new namespace and maintaining something supported the community can move to. If the support story is truly solid, I'm also more than happy to endorse the "official" successor. I do want to make clear, though, that we did search for an appropriate community sponsor of the project prior to the sunsetting of this repo. Unfortunately, no one we talked to really felt it was in their primary domain/expertise to maintain, and so here we are. The project cannot continue under the Angular namespace, and therefore its current NPM package name, because the credentials for publishing must remain tightly controlled by the Angular team. This, along with the unofficial "supported by Angular" moniker the namespace gives the library. But if someone wants to setup, for instance In the meantime, please keep adding migration stories here. When we get closer to the beginning/middle of LTS, I will start publishing guides/blogs, collated from the cases here (along with some harder cases without easy solutions). |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
👍 Actually one could go one step further and create directives out of this … most samples for the new directives composition api just combine styles 😜 |
@CaerusKaru just to clarify, v15 will be the final version of flex-layout right? That was my read of the medium article, and it seems like a lot of folks'. |
Does anyone have a small set of Directives which will do the very basics, like the ones below. I feel that if there was it would solve the majority of uses and provide tremendous value to the community. fxLayout |
no one mentened about a attribute like the following [fxLayoutAlign]="(settings.menuType=='default') ? 'start center' : 'center center'", any idea on converting the above attribute into Tailwind? |
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
ngy-layout is a replacement clone for the discontinued flex-layout. See https://blog.angular.io/modern-css-in-angular-layouts-4a259dca9127 and angular/flex-layout#1426 (comment) Change-Id: Id6f743428d52e8e34ecbddcc3d7b28c1345a3a90
Has anyone found a solution for this issue with fxFlex. Our use looks like
.c3-flex-1-1-auto { It does not translate 1:1 wjat fxFlex does |
Hello Everyone, Just a brief reminder for those looking for migration solutions: I've created an open-source tool to help migrate from ngFlex to TailwindCSS. It's not perfect, but it might make the process a bit easier for some! Please don't hesitate to check it out, and any feedback is welcome! Best, |
Hello, I've developed a CLI designed to simplify the migration process from flex-layout to tailwindcss. The primary goal of this CLI is to automate the entire process, minimizing the need for manual intervention. Ideally, you should not have to make any additional changes once the CLI completes its tasks. Here's what the CLI does for you:
Since it's a CLI tool, you can install it globally and smoothly execute it across multiple projects. My objective with this CLI is to offer a comprehensive 1-to-1 migration solution. Some existing solutions in the discussion thread do not adequately handle some specific cases, which I have taken care to address. Please note that this project is still a work in progress. While you can already use the tool, it's currently in a release candidate state. At present, all flex directives are supported, and my next target is to cover grid directives.
Unfortunately, this part may require manual adjustment for now. I'll continue working on finding a solution, but I cannot guarantee a quick resolution to this particular issue. Same story for custom breakpoints. Feel free to open issues if you notice any problem, any contribution is also welcomed. |
This may work about period. |
@synopss I have raised couple of issues/PR for your migration. Among the ones I know it is working best out of them, but it lacks in some specific use cases. I will be happy to contribute to it. Let me know if you have enough time to maintain the codebase. |
@ayan-bloomscorp thanks for your inputs, I'll check asap. |
Using flex layout with hot cache (fast rebuild) in my Angular app in around 200-300ms:
When I moved to Tailwind also with hot cache a rebuild takes 6500ms+:
Using Uh no thanks. This make rapid development a no go. I go with the community fork: https://github.com/alessiobianchini/ng-flex-layout |
@melroy89 I found that issue if that helps you angular/angular-cli#21228 |
No, that issue you mentioned is closed without any solution. I'm gonna use the ng flex layout fork by alessiobianchini I guess for now. |
Well, if you examine the commit history, you'll see that they worked on it. So, it wasn't necessarily closed without any solution. But if the fork works fine for you then it's best to keep using it I guess. |
@CaerusKaru , please let us know is there any plan to publish a migration guides/blogs ? |
@kiranbs-github This thread has served as a migration guide of sorts, where this excellent community has provided a number of very easy to use alternatives for migrating, running the gamut from static transforms to drop-in replacements (a la @DuncanFaulkner's fork). Unless there are very specific use cases not captured above, in which the community upvotes for a supported approach, this thread (which will remain in perpetuity on the repo) will be the limit of what is provided. I want to take this opportunity to send my deep thanks and concrete appreciation for the efforts of everyone above. You came together to solve an unexpected, shared problem, and did so in a manner that is truly admirable. You're one of the best open source communities out there, and that does not go unnoticed. |
Thanks for pointing out to me @DuncanFaulkner 's fork, which in case anybody else is looking is: You can remove the dicontinued one: npm uninstall @angular/flex-layout --save Install the fork: npm install @ngbracket/ngx-layout --save And change the import: - import { FlexLayoutModule } from '@angular/flex-layout';
+ import { FlexLayoutModule } from '@ngbracket/ngx-layout'; |
@mghaoui-interpulse That is a possibility, note that there is another fork as well. Remove the discontinued one: npm uninstall @angular/flex-layout --save So alternatively, you can migrate to the other fork: npm i -s ng-flex-layout @angular/cdk And change the import: - import { FlexLayoutModule } from '@angular/flex-layout';
+ import { FlexLayoutModule } from 'ng-flex-layout'; Which fork is better? I dunno. |
In accordance with the announcement in the Medium post about this library's future, this is a tracking issue for requesting assistance in migrating complex usages of Angular Layout.
If you believe that your library falls under this case, you can request (or vote on existing) migration guides to other, supported solutions like Tailwind or Angular CDK.
Please use the +1 reaction wherever applicable, and do not comment +1. Those comments will be ignored/deleted.
I appreciate your patience as we go through this process. Until the campaign is complete, the library will still be actively maintained.
In your request, please include the following details:
This will help us prioritize the guides as they are submitted.
The text was updated successfully, but these errors were encountered: