0

I'm working on a webpage for a friend as training using bootstrap 4 for the first time following along with a tutorial and I seem to be doing everything alright up to the point where the teacher starts styling using a sass file. I can't figure out why the code on the scss file isn't doing anything.

I started following along from scratch a couple of times to find possible incongruences but didn't find anything. Could be something related to deprecated versions of GitHub project?

<!DOCTYPE html>
<html class="no-js" lang="en">
    <head>
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="stylesheet" href="css/font-awesome.min.css">
        <link rel="stylesheet" href="css/bootstrap.css">
        <link rel="stylesheet" href="css/style.css">
        <title>As Maiores Duvidas</title>
    </head>

    <body id="home">
        <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
            <div class="container">
                <a href="index.html" class="navbar-brand">As Maiores
                    Duvidas</a>
                <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarCollapse">
                    <ul class="navbar-nav ml-auto">
                        <li class="nav-item">
                            <a href="#home" class="nav-link">Home</a>
                        </li>
                        <li class="nav-item">
                            <a href="#home" class="nav-link">Sobre o Livro</a>
                        </li>
                        <li class="nav-item">
                            <a href="#home" class="nav-link">Sobre o Autor</a>
                        </li>
                        <li class="nav-item">
                            <a href="#home" class="nav-link">Compre o Livro</a>
                        </li>
                        <li class="nav-item">
                            <a href="#home" class="nav-link">Entre em contato</a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
        <!-- nav tag with a couple of classes sm creates the hamburget to show only in small screens-->

        <script src="js/jquery.min.js"></script>
        <script src="js/popper.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
    </body>
</html>

Here's the SCSS code

$bg-color:red;
$font-color:#fff;
$primary-color:#008ed6;

body{
    background:$bg-color;
    color: $font-color;
}

.navbar {
    border-bottom: $primary-color 3px solid;
    opacity: 0.8;
}

package.json content:

{
  "name": "bs4starter",
  "version": "1.0.0",
  "description": "Bootstrap 4 starter workflow",
  "main": "index.js",
  "scripts": {
    "start": "gulp"
  },
  "author": "Brad Traversy",
  "license": "MIT",
  "dependencies": {
    "bootstrap": "^4.1.1",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "node-sass": "^4.12.0",
    "popper.js": "^1.11.1"
  },
  "devDependencies": {
    "browser-sync": "^2.18.13",
    "gulp": "^3.9.1",
    "gulp-sass": "^3.1.0"
  }
}
Pablo Aguirre de Souza
  • 3,939
  • 4
  • 14
  • 30
  • 1
    How are you compiling the SCSS into CSS ? Browsers do not ' read ' SCSS. You must turn it into CSS first. – Mihai T Sep 26 '19 at 07:52
  • Mihai T, how do I check that? I installed the whole thing using npm. – Pablo Aguirre de Souza Sep 26 '19 at 08:08
  • Search on the web and here on SO. There are a bunch of answers/tutorials about this. Check maybe here -> https://stackoverflow.com/questions/31448114/how-to-compile-or-convert-sass-scss-to-css-with-node-sass-no-ruby Or maybe in that tutorial your are doing it explains how to set things up – Mihai T Sep 26 '19 at 08:10
  • I'm really confused as it's my first time dealing with sass so I have no idea what might be wrong. I edited the original question with the package.json file to provide more info. – Pablo Aguirre de Souza Sep 26 '19 at 09:00

1 Answers1

0

You probably didn't compile the SCSS file into CSS. I see that you have node-sass in your package.json file. You can either run

node-sass src/style.scss dest/style.css

or add it to a start script so it runs every time you start the server. I don't recommend doing this though, as you don't always modify this file and it adds time to your boot