<?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: teddcp</title>
    <description>The latest articles on DEV Community by teddcp (@teddcp).</description>
    <link>https://dev.to/teddcp</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%2F257853%2F144f61a8-1b1e-42e6-b75e-8eafa12cd12b.png</url>
      <title>DEV Community: teddcp</title>
      <link>https://dev.to/teddcp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/teddcp"/>
    <language>en</language>
    <item>
      <title>SASS for beginners</title>
      <dc:creator>teddcp</dc:creator>
      <pubDate>Sat, 07 Mar 2020 17:33:36 +0000</pubDate>
      <link>https://dev.to/teddcp/sass-for-beginners-3mbl</link>
      <guid>https://dev.to/teddcp/sass-for-beginners-3mbl</guid>
      <description>&lt;p&gt;This is my first post in DEV and i am super excited to share the stuffs that i have learnt today. I hope, it enlightens you about SASS.&lt;/p&gt;

&lt;p&gt;Syntactically Awesome Style Sheet(SASS) is a pre-compiler which converts bunch of codes to css. So,What is the need of SASS when we can write directly via CSS?&lt;br&gt;
SASS provides some beautiful features and that's the reason it is very popular. I will elaborate the features the one by one.&lt;/p&gt;

&lt;p&gt;Some features are nesting,modularise,function and mixins,conditionals etc.&lt;/p&gt;

&lt;p&gt;One more thing !! There are 2 file types through which we can write SASS &lt;br&gt;
A.  saas extension(style.saas)&lt;br&gt;
B.  sccs extension(style.scss) &lt;strong&gt;Popular&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A. saas -&lt;/p&gt;

&lt;p&gt;The first, known as SCSS (Sassy CSS) and used throughout this reference, is an extension of the syntax of CSS. This means that every valid CSS stylesheet is a valid SCSS file with the same meaning. This syntax is enhanced with the Sass features described below. Files using this syntax have the .scss extension.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; // Some Random style  -&amp;gt;Curly-braces and semi-colons are mandatory for saas
 section{
   color:red;
 }             
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;B. SCSS -&lt;/p&gt;

&lt;p&gt;The second and older syntax, known as the indented syntax (or sometimes just “Sass”), provides a more concise way of writing CSS. It uses indentation rather than brackets to indicate nesting of selectors, and newlines rather than semicolons to separate properties. Files using this syntax have the .sass extension.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Some Random style  -&amp;gt; works through indentation

 section
   color:red
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  *** Features ****
&lt;/h2&gt;
&lt;h2&gt;
  
  
  Variable Declaration -
&lt;/h2&gt;

&lt;p&gt;We can declare variables in SASS and later can access it using '$var-name'.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  //style.scss

  // Variable bgColor is defined with values 'blue'
  $bgColor: blue;  

  nav{
    background: $bgColor;
  }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Nesting -
&lt;/h2&gt;

&lt;p&gt;Often we use multiple selectors to select one particular element( ' ul li a.mylink' will select the anchor tags in li elements which have a class 'mylink').But Saas provides a elegance way of writing i.e nesting the elements inside parent elements.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; nav {
     ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }

    li { display: inline-block; }

    a {
      display: block;
      padding: 6px 12px;
      text-decoration: none;
   }
 }

  /*corresponding css */
    nav ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }

    nav li {
      display: inline-block;
    }

    nav a {
      display: block;
      padding: 6px 12px;
      text-decoration: none;
   }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Modularise  the saas files using partials -
&lt;/h2&gt;

&lt;p&gt;In css, we can write separate files for each individual part of web pages, but managing it is very difficult.We can create partial Sass files that contain little snippets of CSS and we can include them in other Sass files. This is a great way to modularize your CSS and help keep things easier to maintain. A partial is a Sass file named with a leading underscore (_partial.scss). The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file. Then we need to import the partial file to main saas file.For that we can use @use . Don't use @import to include the files as there are some serious issues may arise  with it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // _base.scss
$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}


// styles.scss , 
@use 'base';

.inverse {
  background-color: base.$primary-color;
  color: white;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  @mixins  to make your style sheet DRY -
&lt;/h2&gt;

&lt;p&gt;Sometimes we need certain code to rewrite every time. lets say the vendor prefixes which are added for browser compatibility. Thus we add it for every style elements/tags. So we need some block of code that can be used as a single statement and can do the same job. To include the mixins, we need to use the &lt;a class="comment-mentioned-user" href="https://dev.to/include"&gt;@include&lt;/a&gt;
.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mixin transform($property) {
    -webkit-transform: $property;
    -ms-transform: $property;
    transform: $property;
}
.box { @include transform(rotate(30deg)); }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Inheritance -
&lt;/h2&gt;

&lt;p&gt;For example, in our web page, we need certain border around each of the header and footer. So we need to add the border property in header once and then in footer. Sometime we need to add thousand lines of same code in separate places.Here Inheritance plays a major role. We need to define a block with '%some_name' and then the rules. Then we have to use the @extend to extract those rules.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           %message-shared {
      border: 1px solid #ccc;
      padding: 10px;
      color: #333;
    }

    .success {
      @extend %message-shared;
      border-color: green;
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Operators
&lt;/h2&gt;

&lt;p&gt;With Sass, we can do the mathematical operations easily as it supports +,-,*,/ etc.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   article[role="main"] {
       float: left;
       width: 600px / 960px * 100%;
   }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Some additional things
&lt;/h2&gt;

&lt;p&gt;A. We can use the '&amp;amp;' access the immediate parent element. &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  a{
    color:blue;

    &amp;amp;:hover {    //Represents as a:hover
      color:green;
    }
  }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;B. Interpolation - we can use the #{} for template the value.In the below example, based on the value of $top_or_bottom can be modified.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  #{$top_or_bottom} : 0;

   a:nth-child( #{ $col-num}n ) {} -&amp;gt; a:nth-child(2n)  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Also there are conditionals and loops in SAAS. And lot more. If you are interested for further diving, &lt;a href="https://sass-lang.com/documentation"&gt;here is the link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy learning !!&lt;/p&gt;

</description>
      <category>saas</category>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Doubts related to Django and Django Rest Framework </title>
      <dc:creator>teddcp</dc:creator>
      <pubDate>Fri, 25 Oct 2019 10:47:43 +0000</pubDate>
      <link>https://dev.to/teddcp/doubts-related-to-django-and-django-rest-framework-l36</link>
      <guid>https://dev.to/teddcp/doubts-related-to-django-and-django-rest-framework-l36</guid>
      <description>&lt;p&gt;hi all,&lt;/p&gt;

&lt;p&gt;This is my first question and here it is, i want to learn Django and i have started to build a web page. &lt;/p&gt;

&lt;p&gt;First question : why it is not considered as Front-end language ? It is considered as back-end language  while we can a build a web page where users can interact.&lt;/p&gt;

&lt;p&gt;Second question: Now i came across Django Rest framework Which is quite popular. Why do i need to learn DRF ? what are the advantages ?&lt;/p&gt;

&lt;p&gt;third : Now i am thinking  that it is possible to build a frontend and backend mixed web-app using Django, Right? Then why do we need Angular/React/Vue ??&lt;/p&gt;

&lt;p&gt;Thanks in advance :)&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>django</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
