<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aman</title>
    <description>The latest articles on DEV Community by Aman (@getamano).</description>
    <link>https://dev.to/getamano</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F329541%2F3b262e15-e760-4289-bd28-0cff7339cf8c.jpg</url>
      <title>DEV Community: Aman</title>
      <link>https://dev.to/getamano</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/getamano"/>
    <language>en</language>
    <item>
      <title>Angular 8.x / 9.x &amp; Internet Explorer Not Working. Quick Solution!  </title>
      <dc:creator>Aman</dc:creator>
      <pubDate>Thu, 13 Feb 2020 17:25:30 +0000</pubDate>
      <link>https://dev.to/getamano/angular-8-x-9-x-internet-explorer-not-working-quick-solution-3ha7</link>
      <guid>https://dev.to/getamano/angular-8-x-9-x-internet-explorer-not-working-quick-solution-3ha7</guid>
      <description>&lt;p&gt;When it comes to web application Internet Explorer is always the bad boy (especially IE 11). &lt;/p&gt;

&lt;p&gt;Angular 8 and above are not working on IE at all. Its really hard to test your application on IE, how the layout looks like and etc.&lt;/p&gt;

&lt;p&gt;After you installed Angular 8 or Angular 9 when you run&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;ng serve&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;you will see a white page in Internet Explorer. &lt;/p&gt;

&lt;p&gt;I will show you here how to fix that problem. &lt;/p&gt;

&lt;p&gt;To get Internet Explorer working we need to do the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Un-comment some imports in the polyfill.ts file.&lt;/li&gt;
&lt;li&gt;Install a couple of npm packages.&lt;/li&gt;
&lt;li&gt;Modify the browserslist file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Polyfill Imports
&lt;/h3&gt;

&lt;p&gt;First, open the polyfills file in your IDE or text editor:&lt;br&gt;
the file is found inside your project folder &lt;em&gt;\src\polyfills.ts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are two commented lines you need to un-comment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// import 'classlist.js';  // Run `npm install --save classlist.js`.&lt;/span&gt;

&lt;span class="c1"&gt;// import 'web-animations-js';  // Run `npm install --save web-animations-js`.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Install npm Packages
&lt;/h3&gt;

&lt;p&gt;There are some&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;npm install&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 commands in the comments. You need to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt; &lt;span class="nx"&gt;classlist&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt; &lt;span class="nx"&gt;web&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;animations&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Modify browserslist File
&lt;/h3&gt;

&lt;p&gt;Open the browserslist file in your IDE or text editor:&lt;br&gt;
the file is found inside your project folder \browserslist &lt;/p&gt;

&lt;p&gt;The default file looks something like the below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
#   npx browserslist

&amp;gt; 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You need to change that last line by removing the not. After you make the changes the last line should read:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IE 9-11 # For IE 9-11 support, remove 'not'.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Run on production
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng build --prod
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After building you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd .\dist\project-folder\
npx local-web-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Run on dev
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng serve
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;you will still get the blank Internet Explorer. This is because ng serve doesn’t automatically generate the &lt;em&gt;ES5 bundle&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Do the below quick config:&lt;/p&gt;

&lt;h3&gt;
  
  
  Modify tsconfig.json
&lt;/h3&gt;

&lt;p&gt;You can find your tsconfig.json file in the root of your Angular Workspace. Open it up in your IDE or text editor and you will see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Notice that line:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;target: es2015&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
. You can change it to es5. It will then look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"target": "es5",
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now you can run:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng serve&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Hooray! at this point IE should work.
&lt;/h2&gt;

</description>
      <category>angular</category>
      <category>ie</category>
    </item>
    <item>
      <title>Sass in 5 min</title>
      <dc:creator>Aman</dc:creator>
      <pubDate>Wed, 12 Feb 2020 23:03:16 +0000</pubDate>
      <link>https://dev.to/getamano/sass-in-20-min-3l6b</link>
      <guid>https://dev.to/getamano/sass-in-20-min-3l6b</guid>
      <description>&lt;h2&gt;
  
  
  Sass: Store Data with Sass Variables
&lt;/h2&gt;

&lt;p&gt;One feature of Sass that's different from CSS is it uses variables. They are declared and set to store data, similar to JavaScript. &lt;/p&gt;

&lt;p&gt;In JavaScript, variables are defined using the let and const keywords. &lt;br&gt;
In Sass, variables start with a $ followed by the variable name.&lt;/p&gt;

&lt;p&gt;examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$main-fonts: Arial, sans-serif;
$headings-color: green; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To use variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;h1 {

  font-family: $main-fonts;
  color: $headings-color;

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;One example where variables are useful is when a number of elements need to be the same color. If that color is changed, the only place to edit the code is the variable value. &lt;/p&gt;

&lt;h2&gt;
  
  
  Sass: Nest CSS with Sass
&lt;/h2&gt;

&lt;p&gt;Sass allows nesting of CSS rules, which is a useful way of organizing a style sheet.&lt;/p&gt;

&lt;p&gt;Normally, each element is targeted on a different line to style it, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nav {
  background-color: red;
}

nav ul {
  list-style: none;
}

nav ul li {
  display: inline-block;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;For a large project, the CSS file will have many lines and rules. This is where nesting can help organize your code by placing child style rules within the respective parent elements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nav {
  background-color: red;

  ul {
    list-style: none;

    li {
      display: inline-block;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Sass: Create Reusable CSS with Mixins
&lt;/h2&gt;

&lt;p&gt;In Sass, a mixin is a group of CSS declarations that can be reused throughout the style sheet.&lt;/p&gt;

&lt;p&gt;Newer CSS features take time before they are fully adopted and ready to use in all browsers. As features are added to browsers, CSS rules using them may need vendor prefixes. Consider "box-shadow":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div {
  -webkit-box-shadow: 0px 0px 4px #fff;
  -moz-box-shadow: 0px 0px 4px #fff;
  -ms-box-shadow: 0px 0px 4px #fff;
  box-shadow: 0px 0px 4px #fff;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It's a lot of typing to re-write this rule for all the elements that have a box-shadow, or to change each value to test different effects. Mixins are like functions for CSS. Here is how to write one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mixin box-shadow($x, $y, $blur, $c){ 
  -webkit-box-shadow: $x, $y, $blur, $c;
  -moz-box-shadow: $x, $y, $blur, $c;
  -ms-box-shadow: $x, $y, $blur, $c;
  box-shadow: $x, $y, $blur, $c;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The definition starts with @mixin followed by a custom name. The parameters &lt;br&gt;
(the $x, $y, $blur, and $c in the example above) are optional. Now any time a box-shadow rule is needed, &lt;br&gt;
only a single line calling the mixin replaces having to type all the vendor prefixes. A mixin is called with the &lt;br&gt;
&lt;a class="comment-mentioned-user" href="https://dev.to/include"&gt;@include&lt;/a&gt;
 directive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div {
  @include box-shadow(0px, 0px, 4px, #fff);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Write a mixin for border-radius and give it a $radius parameter. It should use all the vendor prefixes from the&lt;br&gt;
example. Then use the border-radius mixin to give the #awesome element a border-radius of 15px.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;style type='text/sass'&amp;gt;

  @mixin border-radius($radius) {
    border-radius: $radius;
  }

  #awesome {
    width: 150px;
    height: 150px;
    background-color: green;
    @include border-radius(15px);
  }
&amp;lt;/style&amp;gt;
&amp;lt;div id="awesome"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Sass: Use @if and &lt;a class="comment-mentioned-user" href="https://dev.to/else"&gt;@else&lt;/a&gt;
 to Add Logic To Your Styles&lt;br&gt;
The @if directive in Sass is useful to test for a specific case - it works just like the if statement in JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mixin make-bold($bool) {
  @if $bool == true {
    font-weight: bold;
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And just like in JavaScript, &lt;a class="comment-mentioned-user" href="https://dev.to/else"&gt;@else&lt;/a&gt;
 if and &lt;a class="comment-mentioned-user" href="https://dev.to/else"&gt;@else&lt;/a&gt;
 test for more conditions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mixin text-effect($val) {
  @if $val == danger {
    color: red;
  }
  @else if $val == alert {
    color: yellow;
  }
  @else if $val == success {
    color: green;
  }
  @else {
    color: black;
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Sass: Use @for to Create a Sass Loop
&lt;/h2&gt;

&lt;p&gt;The @for directive adds styles in a loop, very similar to a for loop in JavaScript.&lt;/p&gt;

&lt;p&gt;@for is used in two ways: "start through the end" or "start to end". The main difference is that the "start to end" excludes the end number as part of the count, and "start through the end" includes the end number as part of the count.&lt;/p&gt;

&lt;p&gt;Here's a start through end example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@for $i from 1 through 12 {
  .col-#{$i} { width: 100%/12 * $i; }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The #{$i} part is the syntax to combine a variable (i) with text to make a string. When the Sass file is converted to CSS, it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;col-1 {
  width: 8.33333%;
}
.col-2 {
  width: 16.66667%;
}
.col-12 {
  width: 100%;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Sass: Use @each to Map Over Items in a List
&lt;/h2&gt;

&lt;p&gt;The last challenge showed how the @for directive uses a starting and ending value to loop a certain number of times. Sass also offers the @each directive which loops over each item in a list or map. On each iteration, the variable gets assigned to the current value from the list or map.&lt;/p&gt;

&lt;p&gt;Sass: Apply a Style Until a Condition is Met with @while&lt;br&gt;
The @while directive is an option with similar functionality to the JavaScript while loop. It creates CSS rules until a condition is met.&lt;/p&gt;

&lt;p&gt;The @for challenge gave an example to create a simple grid system. This can also work with @while.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sass: Split Your Styles into Smaller Chunks with Partials
&lt;/h2&gt;

&lt;p&gt;Partials in Sass are separate files that hold segments of CSS code. These are imported and used in other Sass files. This is a great way to group similar code into a module to keep it organized.&lt;/p&gt;

&lt;p&gt;Names for partials start with the underscore (_) character, which tells Sass it is a small segment of CSS and not to convert it into a CSS file. Also, Sass files end with the .scss file extension. To bring the code in the partial into another Sass file, use the @import directive.&lt;/p&gt;

&lt;p&gt;For example, if all your mixins are saved in a partial named "_mixins.scss", and they are needed in the "main.scss" file, this is how to use them in the main file:&lt;/p&gt;

&lt;p&gt;// In the main.scss file&lt;br&gt;
@import 'mixins'&lt;/p&gt;

&lt;p&gt;Write an @import statement to import a partial named _variables.scss into the main.scss file.&lt;br&gt;
@import 'variables'&lt;/p&gt;
&lt;h2&gt;
  
  
  Sass: Extend One Set of CSS Styles to Another Element
&lt;/h2&gt;

&lt;p&gt;Sass has a feature called extend that makes it easy to borrow the CSS rules from one element and build upon them in another.&lt;/p&gt;

&lt;p&gt;For example, the below block of CSS rules style a .panel class. It has a background-color, height and border.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.panel{
  background-color: red;
  height: 70px;
  border: 2px solid green;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now you want another panel called .big-panel. It has the same base properties as .panel, but also needs a width and font-size. It's possible to copy and paste the initial CSS rules from .panel, but the code becomes repetitive as you add more types of panels. The extend directive is a simple way to reuse the rules written for one element, then add more for another:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.big-panel{
  @extend .panel;
  width: 150px;
  font-size: 2em;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The .big-panel will have the same properties as .panel in addition to the new styles.&lt;/p&gt;

</description>
      <category>sass</category>
      <category>css</category>
    </item>
  </channel>
</rss>
