<?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: Harvey Jones</title>
    <description>The latest articles on DEV Community by Harvey Jones (@harveyjones282).</description>
    <link>https://dev.to/harveyjones282</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%2F168149%2F35bb8cd3-b56f-46b0-bbab-58cfdd9b0afb.jpg</url>
      <title>DEV Community: Harvey Jones</title>
      <link>https://dev.to/harveyjones282</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harveyjones282"/>
    <language>en</language>
    <item>
      <title>The Simplest Way To CONFIGURE NEXT.JS With SASS</title>
      <dc:creator>Harvey Jones</dc:creator>
      <pubDate>Tue, 11 Jun 2019 09:48:32 +0000</pubDate>
      <link>https://dev.to/harveyjones282/the-simplest-way-to-configure-next-js-with-sass-3en</link>
      <guid>https://dev.to/harveyjones282/the-simplest-way-to-configure-next-js-with-sass-3en</guid>
      <description>&lt;p&gt;Styling is a core part of designing application pages. Whenever I start working on Next.js, I usually find myself wasting some time googling how to configure SCSS in my project. So, in order to save your precious time, I have decided to pen down this issue as a reference.&lt;/p&gt;

&lt;p&gt;Although Next.js offers a really sophisticated plugin &lt;a href="https://github.com/zeit/next-plugins/tree/master/packages/next-sass"&gt;next-sass&lt;/a&gt; for compiling sass files but this plugin fails to parse &lt;strong&gt;.eot&lt;/strong&gt; and &lt;strong&gt;.woff&lt;/strong&gt; files. So for parsing all our sass and font files, we have to add custom Webpack configuration inside next-sass.&lt;/p&gt;

&lt;p&gt;Next-sass compiled stylesheet to &lt;strong&gt;.next/static/css.&lt;/strong&gt; Next.js will automatically add the CSS to your HTML files.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1: Install Dependencies
&lt;/h1&gt;

&lt;p&gt;Let’s start by installing dependencies. &lt;/p&gt;

&lt;p&gt;First, we need to install next-sass.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`npm install --save @zeit/next-sass`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next-sass plugin used node sass so we have to install node-sass as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; `npm install --save @zeit/node-sass`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2: Create the Next Config File
&lt;/h1&gt;

&lt;p&gt;Now, create the &lt;strong&gt;next.config.js&lt;/strong&gt; file in the root of your project directory. Next.js automatically reads all configurations from this file. So you just need to add the configurations here and export them.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 3: Add Customize the Configuration
&lt;/h1&gt;

&lt;p&gt;Now, We have to add customized configuration inside next-sass to make it work fully and functional for compiling &lt;strong&gt;SASS&lt;/strong&gt; and font files.&lt;/p&gt;

&lt;p&gt;This configuration is capable of parsing following file types:&lt;br&gt;
Sass and css files&lt;br&gt;
Font files (.eot, .woff, .woff2)&lt;br&gt;
Image files (.png, jpg, .gif, .svg)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const withSass = require('@zeit/next-sass');
const withCSS = require("@zeit/next-css");
module.exports = withCSS(withSass({
   webpack (config, options) {
       config.module.rules.push({
           test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
           use: {
               loader: 'url-loader',
               options: {
                   limit: 100000
               }
           }
       });

       return config;
   }
}));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Great! You now have sass configured and I now have my permanent reference. Cheers!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>configure</category>
      <category>sass</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
