<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://angrynerds.co/blog/rss/xslt"?>
<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Blog</title>
    <link>https://angrynerds.co/blog</link>
    <description />
    <generator>Articulate, blogging built on Umbraco</generator>
    <item>
      <guid isPermaLink="false">3684</guid>
      <link>https://angrynerds.co/blog/css-tips-and-tricks-for-text-based-content/</link>
      <category>Development</category>
      <title>CSS tips and tricks for text-based content</title>
      <description>&lt;p&gt;This is why today, instead of exploring advanced Javascript’s logic, Typescript’s shadows, and new versions of Angular, we want to get back to basics and share with you some useful tricks in CSS that can help you improve and speed up your daily work with styling text content.&lt;/p&gt;
&lt;h2&gt;Selectors&lt;/h2&gt;
&lt;p&gt;There are a lot of available selectors in CSS that can specify the exact element you want to style. We chose a few to show you their power - and inspire you to discover more.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;gt;&lt;/code&gt; in the selector selects the direct child of the element. It’s very useful for example when you want to change the styles of paragraphs in a particular section. 
The below code will change styles of paragraphs only if they’re direct children of the .sidebar container.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.sidebar &amp;gt; p
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
&lt;code&gt;+&lt;/code&gt; in the selector selects only the adjacent sibling of the first element. The below code will change styles of the paragraph which is placed directly after the .sidebar container, but not inside of it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.sidebar+p 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
You can also use &lt;code&gt;+&lt;/code&gt; with &lt;code&gt;*&lt;/code&gt; sign and easily select all paragraphs on your website.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;*+p
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
&lt;code&gt;:first-letter&lt;/code&gt; added to a selector will change the style of the first letter only and make a drop cap.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;p:first-letter {
color: #07072d;
display: block;
font-size: 3em;
float: left;
margin: 0 3px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div style="display: block; width: 300px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2118/dropcap.png"&gt;
&lt;/div&gt;
&lt;p&gt;In the most common cases &lt;code&gt;:nth-child()&lt;/code&gt; is used by developers with static value (&lt;code&gt;:nth-child(2)&lt;/code&gt;) to select the exact child of the element. But did you know that you can use this selector also with an expression? For instance, if you have a leaderboard and want to change the font color of the top three you can simply select them by:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:nth-child(-n + 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div style="display: block; width: 200px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2117/leaderboard.png"&gt;
&lt;/div&gt;
&lt;h2&gt;Counters&lt;/h2&gt;
&lt;p&gt;Counters in CSS allow you to automatically number the elements on the website based on how many times they’re used. There are a few simple rules you should know before starting using counters:&lt;/p&gt;
&lt;p&gt;→ Counters should be initialized by counter-reset property (0 by default):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;counter-reset: section;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
→ You have to specify the value of the element which should increment the counter:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;counter-increment: section;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
 → You have to set the counters’ content: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;content: &amp;quot;Section no. &amp;quot; counter(section) &amp;quot;: &amp;quot;;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
→ To combine counters in nested lists use counters() method and join counters into one value: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;content: counter(section) &amp;quot;.&amp;quot; counter(article) &amp;quot; &amp;quot;;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
Here’s the result - all the characters in orange are made with CSS only:&lt;/p&gt;
&lt;div style="display: block; width: 300px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2123/counters.png"&gt;
&lt;/div&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;Shape-outside&lt;/h2&gt;
&lt;p&gt;A wall of text looks boring and you want to add some pictures to your article without interrupting users’ reading? The &lt;code&gt;shape-outside&lt;/code&gt; property will be helpful in blending the content together.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;shape-outside: inset(70px 0px 60px 0px);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div style="display: block; width: 400px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2119/shape1.png"&gt;
&lt;/div&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;At first look, it doesn’t look very special but imagine you can mix it with clip-path property and adjust text and indentations to every shape you can think of - isn’t it cool?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;shape-outside: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div style="display: block; width: 400px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2122/shape2.png"&gt;
&lt;/div&gt;
&lt;h2&gt;Line-clamp&lt;/h2&gt;
&lt;p&gt;Small wrapper and a lot of text? To avoid breaking the layout you need to cut the text and make it fit the size of the container.
You can do it simply by &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
and change this:&lt;/p&gt;
&lt;div style="display: block; width: 300px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2120/lineclamp1.png"&gt;
&lt;/div&gt;
&lt;p&gt;into this:&lt;/p&gt;
&lt;div style="display: block; width: 300px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2124/lineclamp2.png"&gt;
&lt;/div&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Nice, but we clipped a lot of content and now it’s almost unreadable for the user. If you want to cut the text, e.g. after the 3rd line, it’ll be a little challenging to do it this way. Of course, you can do it once and reuse the code every time you need, but you can also just use the &lt;code&gt;line-clamp&lt;/code&gt; property and effortlessly achieve this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-webkit-line-clamp: 3;
-webkit-box-orient: vertical;  
display: -webkit-box;
overflow: hidden;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div style="display: block; width: 300px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2121/lineclamp3.png"&gt;
&lt;/div&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;::selection&lt;/h2&gt;
&lt;p&gt;Do you know that you can change the styles of the text highlighted by the user? Using pseudo-class &lt;code&gt;::selection&lt;/code&gt; you can change styles to whatever you want and make your website more customized, consistent - and simply cool!&lt;/p&gt;
&lt;div style="display: block; width: 400px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2127/selection1.gif"&gt;
&lt;/div&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div style="display: block; width: 400px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/2126/selection2.gif"&gt;
&lt;/div&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h5&gt;Hope you enjoyed these CSS tips and tricks! We encourage you to try them out and see for yourself how they can make your work easier and more enjoyable. Let us know if you have any questions or want to share your thoughts!&lt;/h5&gt;
&lt;h3&gt;Happy styling 🎨&lt;/h3&gt;
&lt;h4&gt;You may be also interested in:&lt;/h4&gt;
&lt;p&gt;➤ &lt;a href="/blog/how-to-optimize-angular-app/" target="_blank"&gt;How to optimize an Angular app. 13 tips for front-end developers&lt;/a&gt;&lt;br /&gt;
➤ &lt;a href="/blog/8-useful-chrome-extensions-for-front-end-developers-and-a-bonus/" target="_blank"&gt;8 useful Chrome extensions for front-end developers&lt;/a&gt;&lt;br /&gt;
➤ &lt;a href="/blog/automating-repetitive-actions-with-selenium-webdriver-and-nodejs/" target="_blank"&gt;Automating repetitive actions with Selenium WebDriver and Node.js&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;About the Author&lt;/strong&gt;&lt;br /&gt; 
&lt;a href="https://www.linkedin.com/in/weronikaszymanska/" target="_blank"&gt;Weronika Szymańska&lt;/a&gt; is a front-end developer at Angry Nerds – which means her job is to reconcile our designers’ unlimited imagination with equally unrestrained ideas of back-end devs. And she’s great at it! She has strong experience in JavaScript and Angular development and loves to share tips and tricks she uses in her daily work. When she's not coding, she can be found hiking in the mountains or reading crime stories. &lt;/p&gt;
</description>
      <pubDate>Mon, 07 Dec 2020 09:59:06 Z</pubDate>
      <a10:updated>2020-12-07T09:59:06Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">3459</guid>
      <link>https://angrynerds.co/blog/how-to-optimize-angular-app/</link>
      <category>Development</category>
      <title>How to optimize an Angular app. 13 tips for front-end developers</title>
      <description>&lt;p&gt;Optimization is a process, and it should start at the same time as the &lt;a href="/services/web-development/"&gt;app development&lt;/a&gt;. It’s really hard to optimize the application that already exists (though it’s still possible of course), so we should take care of it during the whole project. &lt;/p&gt;
&lt;p&gt;Here's a list of the best tips to help keep your code in line with good practices and make your Angular application faster. Enjoy and optimize!&lt;/p&gt;
&lt;h2&gt;1. Code minification&lt;/h2&gt;
&lt;p&gt;Trivial, but really important - each part of the application should be minified before deploying to the production stage. If you have ever used Webpack, you probably know plugins such as UglifyJS, MinifyCSS, etc. They remove every whitespace and every function that is never executed. Moreover, they change functions' and variables' names to shorter ones that make the code almost unreadable, but the size of the compiled bundle is smaller.
Fortunately, with Angular, we don’t have to remember to add Webpack scripts to minify the code. All we have to do is make a bundle using &lt;code&gt;ng build --prod&lt;/code&gt; command. It’s just good to know when and how it happens.&lt;/p&gt;
&lt;h2&gt;2. OnPush Change Detection&lt;/h2&gt;
&lt;p&gt;Each Angular component has its own Change Detector that is responsible for detecting when the component data has been changed, and automatically re-render the view to reflect the changes. Change Detector is called whenever DOM emits an event (button click, form submit, mouseover etc.), an HTTP request is executed, or there’s an asynchronous interaction such as setTimeout or setInterval. On every single event, the Change Detector will be triggered in the whole application tree (from the top to the bottom, starting with the root component).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1990/onpush1.png" /&gt;&lt;/p&gt;
&lt;p&gt;The numbers show the order of checking the changes by the Change Detectors after the event in the Component in the left bottom corner.
To change Detection Strategy for the component, the changeDetection in Component declaration should be set to ChangeDetectionStrategy.OnPush as below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@Component({
   ...
   changeDetection: ChangeDetectionStrategy.OnPush
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
After that, the Change Detectors will work by comparing references to the inputs of the component. Inputs in this component are immutable and if values in these inputs have not changed, change detection skips the whole subtree of Change Detectors, as depicted below:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1988/onpush2.png" /&gt;&lt;/p&gt;
&lt;p&gt;Change detector for a component with OnPush Strategy will be triggered only when a value in @Input() has been changed, an event has been emitted by a template, an event has been triggered by Observable in this component or &lt;code&gt;this.changeDetector.markForCheck()&lt;/code&gt; has been called.&lt;/p&gt;
&lt;h2&gt;3. Pure pipes instead of functions/getters in templates&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;class foo {
   private _bar: boolean = false;
   get bar(): boolean {
      return this._bar;
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
&lt;code&gt;get&lt;/code&gt; used in the view is nothing more than a function call. A better idea is to use pure pipes which will always return the same output, no matter how many times they will receive the same input. If the Change Detector reaches this view and pure in the pipe is set to true (default), the Change Detector will not check if that value has been changed because it knows that it will return exactly the same value.&lt;/p&gt;
&lt;h2&gt;4. Async pipe&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;Time: {{ time | async }}&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
The async pipe allows subscribing to Observable directly from the template.
With async pipe, there's no need to bother about unsubscribing. What’s more, Change Detector will check if the value was changed only when Observable had changed itself.&lt;/p&gt;
&lt;h2&gt;5. Unsubscribing&lt;/h2&gt;
&lt;p&gt;When using RxJS, it’s really important not to forget about unsubscribing, otherwise there’s a risk to get memory leaks in our application. There are a few methods to unsubscribe a Subscription, but choosing the best one is probably a subject for another blog post - for now, just remember to do it. Here are the methods →&lt;/p&gt;
&lt;p&gt;1st method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;let sub1: Subscription;
let sub2: Subscription;

ngOnInit() {
   this.sub1 = this.service.Subject1.subscribe(() =&amp;gt; {});
   this.sub2 = this.service.Subject2.subscribe(() =&amp;gt; {});
}

ngOnDestroy() {
   if (this.sub1) {
      this.sub1.unsubscribe();
   }
   if (this.sub2) {
      this.sub2.unsubscribe();
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
2nd method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;let subs: Subscription[] = [];

ngOnInit() {
   this.subs.push(this.service.Subject1.subscribe(() =&amp;gt; {}));
   this.subs.push(this.service.Subject2.subscribe(() =&amp;gt; {}));
}

ngOnDestroy() {
   subs.forEach(sub =&amp;gt; sub.unsubscribe());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
3rd method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;private subscriptions = new Subscription();

ngOnInit() {
   this.subscriptions.add(this.service.Subject1.subscribe(() =&amp;gt; {}));
   this.subscriptions.add(this.service.Subject2.subscribe(() =&amp;gt; {}));
}

ngOnDestroy() {
   this.subscriptions.unsubscribe();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
4th method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ngUnsubscribe = new Subject();

ngOnInit() {
   this.service.Subject1.pipe(takeUntil(this.ngUnsubscribe))
      .subscribe(() =&amp;gt; {});
   this.service.Subject2.pipe(takeUntil(this.ngUnsubscribe))
      .subscribe(() =&amp;gt; {});
}

ngOnDestroy() {
   this.ngUnsubscribe.next();
   this.ngUnsubscribe.complete();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;4. Track by function&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;*ngFor=&amp;quot;let item of items; trackBy: trackByFn&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
trackBy is a parameter that accepts a function that should return a unique value of each item of the list. Without using trackBy function, *ngFor will re-render each and every element of the list every time that list changes (each element will be removed from DOM and rendered once again). With trackBy function, only the values that have been changed will be re-rendered or deleted. &lt;/p&gt;
&lt;h2&gt;5. Webpack Bundle Analyzer&lt;/h2&gt;
&lt;p&gt;If you find out that your bundle’s size is too big, you can check what exactly is in the bundle and decide whether you need all the external libraries or not. You can use e.g. Webpack Bundle Analyzer. All you need to do is just provide a simple configuration based on your application and your needs, and analyze the output graph.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1989/graph.png" /&gt;&lt;/p&gt;
&lt;h2&gt;6. You probably don’t need external libraries&lt;/h2&gt;
&lt;p&gt;After generating a graph via Webpack Bundle Analyzer you probably know that you shouldn’t add the whole library to your project if you use only a small feature from it. Try to code the same function that you import from the library on your own. For example, a concat method from Lodash&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { concat } from 'lodash'
concat([1], 2, [3], [[4]])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
is nothing more than&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[1].concat(2, [3], [[4]])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
The more code you write on your own, the bigger control and understanding of how it works you have. Moreover, it’s easier to debug and maintain the code without unnecessary external libraries.
However, if you need to import something, choose modular library and &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { chunk } from “lodash”
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
instead of&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import * from “lodash”  
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;7. Styles per component&lt;/h2&gt;
&lt;p&gt;No matter if you use SASS, LESS or pure CSS (is there anybody who still uses pure CSS? 😉) try to write as many styles per component as you can, instead of global ones.
In the files with global styles declare variables with colors, fonts, reusable components, like buttons, dropdowns, form inputs, but keep everything else divided into components.
Properties will be loaded only if the component is used in the rendered page, so it means better performance for the application. For you, as a front-end developer, it means that the SCSS is scoped and simplified, so you will be probably more productive during development. &lt;/p&gt;
&lt;h2&gt;8. Tree shaking&lt;/h2&gt;
&lt;p&gt;You can imagine that the application is a tree with green and brown leaves that refer respectively to used and unused parts of the code. When you try to shake that tree, the brown leaves (dead code) will fall down.
When using &lt;code&gt;ng build --prod&lt;/code&gt; to build, the Angular CLI will compile and bundle all components into the application.
When using &lt;code&gt;ng build --prod --build-optimizer&lt;/code&gt; to build, all of the unused components will be omitted.
&lt;code&gt;--build-optimizer&lt;/code&gt; activates tree shaking (a term commonly used for dead-code elimination in JavaScript context) on Webpack.
Unfortunately, this can cause some bugs, so be really careful while doing that and rather than excluding &lt;strong&gt;dead code,&lt;/strong&gt; try including &lt;strong&gt;living code&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;9. One-time string initialization&lt;/h2&gt;
&lt;p&gt;While binding properties between components check if: &lt;br /&gt;
• the target property accepts a string value,&lt;br /&gt;
• the string is a fixed value that you can put directly into the template,&lt;br /&gt;
• this initial value never changes. &lt;br /&gt;
&lt;i&gt;[Source: &lt;a href="https://angular.io/guide/template-syntax#one-time-string-initialization" target="_blank" rel="nofollow"&gt;Angular.io&lt;/a&gt;]&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;
If if the property covers all of these criteria omit the brackets and use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;label=&amp;quot;Save&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
instead of&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[label]=”’Save’”
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
This way the Change Detector will not check it while running in the component.&lt;/p&gt;
&lt;h2&gt;10. Dependencies between components&lt;/h2&gt;
&lt;p&gt;The next thing to consider are dependencies between components in the application. Are all of them really necessary? Do you want and need them all? Try to check it by generating and analyzing dependencies graph (for example NGD: Angular Dependencies Graph).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1991/dependencies.png" /&gt;&lt;/p&gt;
&lt;p&gt;It can be also helpful when you start working on an already existing project and want to have an overview of the architecture of the application.&lt;/p&gt;
&lt;h2&gt;11. CSS vs. JS animations&lt;/h2&gt;
&lt;p&gt;Remember to use the appropriate animations, depending on what you want to achieve. CSS animations are perfect for smaller, self-contained states for UI elements, e.g. a sidebar with menu appearing from the side, a tooltip showing on hover, while JavaScript gives more control over animations, e.g. possibility to stop, slow down, reverse or pause the animation.
CSS animations are smaller so use them every time you can, and only when they are not enough for you, choose JS ones.
A good practice is to use a CSS animation to make a global loader for the application - then, even if the JavaScript of the application doesn’t load properly, the user can see a nice, animated loader.&lt;/p&gt;
&lt;h2&gt;12. Lazy loading&lt;/h2&gt;
&lt;p&gt;Lazy loading loads only those modules and components that are necessary. If the user is not an admin, there is no need to load the entire AdminModule, and if the user is not signed into the application and uses it anonymously, there is no need to load the AccountModule, which allows to view and edit the profile. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const routes: Routes = [
          { path: 'account',
          loadChildren: () =&amp;gt; import('./account/account.module')
          .then(m =&amp;gt; m.AccountModule) },
          { path: admin,
          loadChildren: () =&amp;gt; import('./admin/admin.module')
          .then(m =&amp;gt; m.AdminModule) }
];
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
What's more, you can try lazy load for a bigger amount of images or longer content - load it on scroll.&lt;/p&gt;
&lt;h2&gt;13. Throw it away to the backend&lt;/h2&gt;
&lt;p&gt;Move as much application logic as possible to the backend. When the logic of the application relies little on the choices of the user, there is no need to perform huge calculations on the frontend side.&lt;/p&gt;
&lt;h3&gt;We hope these tips will help you with your next Angular project. If you have anything to add, feel free to share your thoughts in the comments!&lt;/h3&gt;
&lt;h4&gt;You may be also interested in:&lt;/h4&gt;
&lt;p&gt;➤ &lt;a href="/blog/css-tips-and-tricks-for-text-based-content/" target="_blank"&gt;CSS tips and tricks for text-based content&lt;/a&gt;&lt;br /&gt;
➤ &lt;a href="/blog/8-useful-chrome-extensions-for-front-end-developers-and-a-bonus/" target="_blank"&gt;8 useful Chrome extensions for front-end developers&lt;/a&gt;&lt;br /&gt;
➤ &lt;a href="https://www.toptal.com/front-end/how-to-hire" target="_blank"&gt;The most important skills you need to be a good front-end developer&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;About the Author&lt;/strong&gt;&lt;br /&gt; 
&lt;a href="https://www.linkedin.com/in/weronikaszymanska/" target="_blank"&gt;Weronika Szymańska&lt;/a&gt; is a front-end developer at Angry Nerds – which means her job is to reconcile our designers’ unlimited imagination with equally unrestrained ideas of back-end devs. And she’s great at it! She has strong experience in JavaScript and Angular development and loves to share tips and tricks she uses in her daily work. When she's not coding, she can be found hiking in the mountains or reading crime stories. &lt;/p&gt;
</description>
      <pubDate>Wed, 18 Mar 2020 13:40:31 Z</pubDate>
      <a10:updated>2020-03-18T13:40:31Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">3216</guid>
      <link>https://angrynerds.co/blog/8-useful-chrome-extensions-for-front-end-developers-and-a-bonus/</link>
      <category>Development</category>
      <title>8 useful Chrome extensions for front-end developers - and a bonus</title>
      <description>&lt;p&gt;We believe that the list will serve both experienced coders and beginners. Seniors can use it as an inspiration to refresh their toolbox. And as for juniors - we can't promise that the listed tools will make you a front-end superstar instantly, but we're quite sure they'll be helpful on the way!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1711/marc-mueller-lg8xtzjs6lg-unsplash_opt.jpg" alt="chrome plugins for developers" /&gt;&lt;/p&gt;
&lt;h2&gt;Quick JavaScript Switcher&lt;/h2&gt;
&lt;p&gt;This one allows you to &lt;a href="https://chrome.google.com/webstore/detail/quick-javascript-switcher/geddoclleiomckbhadiaipdggiiccfje?hl=en" target="_blank"&gt;disable or enable JavaScript&lt;/a&gt; on the fly by hostname and subdomain. It's really useful when you want to check how your page will look like when there's an error and your JavaScript code doesn't load properly. The reason isn't always an error though — there are some people who reportedly use this plugin as a default setting, in order to improve the speed of their browser. So as a front-end developer, you can test your work for such cases as well and make sure all the content is readable.&lt;/p&gt;
&lt;h2&gt;Dimensions, Page Ruler&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://chrome.google.com/webstore/detail/dimensions/baocaagndhipibgklemoalmkljaimfdj?hl=en" target="_blank"&gt;Dimensions&lt;/a&gt; is a very useful extension when you want to make a pixel-perfect website - and you should always aim at making a pixel-perfect website! With this plugin, you can simply measure all the sizes and distances between elements, such as the sizes of inputs or the distances between images.
&lt;a href="https://chrome.google.com/webstore/detail/page-ruler/emliamioobfffbgcfdchabfibonehkme?hl=en" target="_blank"&gt;Page Ruler&lt;/a&gt; works the same way as Dimensions but you can select your own area to measure and check how big it is.&lt;/p&gt;
&lt;div style="display: block; width: 400px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/1714/dim.png" alt="chrome ruler devtools"&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1710/ruler.png" alt="page ruler chrome" /&gt;&lt;/p&gt;
&lt;h2&gt;PerfectPixel&lt;/h2&gt;
&lt;p&gt;Speaking of pixel-perfect websites... Have you ever heard from a designer that your page isn't exactly the same as his design? With this extension you can prove him wrong! &lt;a href="https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi?hl=en" target="_blank"&gt;PerfectPixel&lt;/a&gt; allows you to add a semi-transparent overlay with the design and check if there are any differences. And surely there are none!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1718/perfectpixel.png" alt="pixel perfect chrome" /&gt;&lt;/p&gt;
&lt;h2&gt;Window Resizer&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://chrome.google.com/webstore/detail/window-resizer/kkelicaakdanhinjdeammmilcgefonfh?hl=en" target="_blank"&gt;Window Resizer&lt;/a&gt; can improve the way you test your website's layout on different devices. You can save presets with dimensions you most often need and simply change your browser's window size. It also allows you to swipe the orientation of the device from horizontal to vertical to emulate the behavior of smartphones. &lt;/p&gt;
&lt;div style="display: block; width: 400px; margin: 0 auto;"&gt;
&lt;img src="https://angrynerds.co/media/1717/windowre.png" alt="window resizer chrome"&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2&gt;React Developer Tools&lt;/h2&gt;
&lt;p&gt;This extension allows you to inspect hierarchies of components in your &lt;a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en" target="_blank"&gt;React&lt;/a&gt; application. It works only for React and you can find it as a new tab in DevTools (called React). You can also check the props and state of the selected component. The really good thing is that if you select any element in the &lt;em&gt;Elements&lt;/em&gt; tab in DevTools it will be also selected in the &lt;em&gt;React&lt;/em&gt; tab, so you don't have to waste time to look for it twice.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1716/react.png" alt="react developer tools" /&gt;&lt;/p&gt;
&lt;h2&gt;What font?&lt;/h2&gt;
&lt;p&gt;The name speaks for itself in this case! With &lt;a href="https://chrome.google.com/webstore/detail/whatfont/jabopobgcpjmedljpbcaablpmlmfcogm?hl=en" target="_blank"&gt;What font&lt;/a&gt; you can identify the font used on the page without checking it in DevTools. You can also see other details: size, line height, style, weight and color of a selected text. Saves lots of time!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1719/whatfont.png" alt="what font chrome" /&gt;&lt;/p&gt;
&lt;h2&gt;ColorZilla&lt;/h2&gt;
&lt;p&gt;The end of the color struggle! With &lt;a href="https://www.colorzilla.com/" target="_blank"&gt;ColorZilla&lt;/a&gt; you can check every color on your website and get its hex number using simple picker. Besides, there's complete information about class, id, tag name and size of the selected element. The extension also includes a link to the CSS gradient generator and the history of recently picked colors. &lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1720/colorzilla.png" alt="colorzilla chrome" /&gt;&lt;/p&gt;
&lt;h2&gt;Bonus! How to enable dark theme for DevTools?&lt;/h2&gt;
&lt;p&gt;Do you enjoy using dark theme for macOS system or your code editor? You can easily have it the same way in the Chrome browser DevTools. This time there's no extension needed - you can quickly enable it in the &lt;em&gt;Settings&lt;/em&gt;. Here's a &lt;a href="https://developers.google.com/web/tools/chrome-devtools/customize/dark-theme" target="_blank"&gt;step by step guide&lt;/a&gt;. Make your working environment classy!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://angrynerds.co/media/1712/dark.png" alt="DevTools" /&gt;&lt;/p&gt;
&lt;h3&gt;Anything to add? Feel free to share your suggestions in the comments!&lt;/h3&gt;
&lt;p&gt;&lt;br /&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;About the Author&lt;/strong&gt;&lt;br /&gt; 
&lt;a href="https://www.linkedin.com/in/weronikaszymanska/" target="_blank"&gt;Weronika Szymańska&lt;/a&gt; is a front-end developer at Angry Nerds – which means her job is to reconcile our designers’ unlimited imagination with equally unrestrained ideas of back-end devs. And she’s great at it! She has strong experience in JavaScript and Angular development and loves to share tips and tricks she uses in her daily work. When she's not coding, she can be found hiking in the mountains or reading crime stories. &lt;/p&gt;
</description>
      <pubDate>Thu, 01 Aug 2019 12:15:05 Z</pubDate>
      <a10:updated>2019-08-01T12:15:05Z</a10:updated>
    </item>
  </channel>
</rss>