If you're considering switching out your design framework, think twice before diving in. How often have you actually changed your design framework in the past? Chances are, not very often.
The appearance of a component involves much more than just the individual buttons and inputs. Factors like layout and responsiveness play a significant role in shaping the overall view. For instance, if you opt for material design and wrap a md-button
in my-custom-button
, as your application evolves, you'll likely need to add padding or margin around the containers holding these controls to achieve a more cohesive Material design aesthetic. Eventually, when you decide to adopt a new design pattern, replacing the buttons alone won't suffice; you'll have to modify all your views to align with the new style. Therefore, views encompass more than just the basic components, making it impractical to individually wrap each component.
A more sensible approach would be to create separate templates for each component.
Suppose your entire application is built using Material design, and now you want to transition to a new design framework. First, you'd need to rename all your templates:
login.component.html
> login.component.material.html
Subsequently, create new templates tailored to the new framework:
login.component.newhotness.html
Then, establish a build process that can replace the templateUrl
during the build phase based on predefined configurations. By adopting this approach, you can seamlessly integrate technologies like Ionic or NativeScript, which utilize a distinct XML-based syntax instead of HTML for their views.
Key points to remember:
- Avoid wrapping existing library components with custom variations
- Maintain component templates in distinct files
- When transitioning to a new framework, develop unique templates for each component and label the older templates with a name that indicates the framework they belong to
- And finally, reap the rewards of your hard work!