My React project is unable to import the foundation SCSS file into the App.scss file

After installing zurb-foundation using npm, I attempted to import the .scss file into my App.scss file. Utilizing the "live sass server" for compiling the .scss code into .css code, a .css file was generated but did not display any code despite successfully importing the .scss from foundation into my App.scss

The image shows the .scss code on the left and the corresponding .css code on the right

Answer №1

if you happen to have three different files:

SASS FORMAT

The first file looks like this:

SASS SYNTAX
// foundation/_code.sass
code
  padding: .25em
  line-height: 0

The second file is as follows:

// foundation/_lists.sass
ul, ol
  text-align: left

  & &
    padding:
      bottom: 0
      left: 0

You are able to combine your files using imports in the following manner.

Please note: The file name must adhere to this specific syntax:

_{name of file}.sass

// app.sass
@import foundation/code, foundation/lists

SCSS STYLE

The first file appears like this:

// foundation/_code.scss
code {
  padding: .25em;
  line-height: 0;
}

And the second file has the structure below:

// foundation/_lists.scss
ul, ol {
  text-align: left;

  & & {
    padding: {
      bottom: 0;
      left: 0;
    }
  }
}

Lastly, there is a third file included:

// style.scss
@import 'foundation/code', 'foundation/lists';

To delve deeper into this topic, check out: sass docs @import

Answer №2

Did you explore the option of using

@import '../node_modules/foundation-sites/scss/foundation.scss'
?

Instead of importing the entire Foundation code, consider selecting only what you need, such as the breakpoint mixins for your SCSS:

@import "~foundation-sites/scss/util/util";
@import "~foundation-sites/scss/util/breakpoint";

By selectively importing components, you can minimize the size of your CSS file and optimize performance.

For more information, check out

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is causing the issue of the div not being removed from the label renderer in three.js

Hello, I've been trying to solve this issue for the third time now without much success. The problem I'm facing is related to creating a div at runtime and then attempting to remove it after clicking on it. Although I've tried removing the d ...

Encountering an npm installation error: What does this signify and how can it be resolved?

After attempting to use npm install, I encountered the following error. What steps should I take to address it and is this something to be concerned about? How can I get in touch with the author? 17723 error code E404 17724 error 404 Not Found - GET htt ...

What steps should I take to insert a divider in a dropdown menu?

I am attempting to enhance my dropdown menu by incorporating a separator using the following code: <li class='divider'></li> Below is my HTML code with the separator included: <ul class="dropdown-menu dropdown-menu-right" id="ul ...

How can I include npm package js and css files in Vue CLI with webpack?

I am currently attempting to integrate an npm package into my vue-cli development site. The instructions provided by the package website are as follows: https://i.stack.imgur.com/R2Inl.png The instructions state that both the css and js files need to be ...

Accessing the inputValue of Autocomplete from Material UI using a reference like React.useRef

I am currently working on accessing the value inside the Autocomplete's inputValue. I passed a reference to the Autocomplete as a functional component, but I'm struggling to find a way to access the current value of inputValue in order to determi ...

What is the process for removing the highlighted border from a navigation menu in ASP.NET?

I am currently utilizing the navigation menu in the ASP.NET toolbox, but I am struggling to remove an unwanted golden border. Despite my efforts, I have not been able to find any information on how to resolve this issue. The golden border only appears when ...

Unable to manage the DatePicker error in Material UI

I am facing an issue with the DatePicker component where it displays a red border when there is an empty value. Setting true/false to error attribute does not seem to have any effect. Even passing error to the TextField component does not change anything. ...

Styling Angular Datatables with CSS

i have data on the front end https://i.stack.imgur.com/2xq7a.jpg i need all check marks to be displayed in green color. Below is the code snippet: $scope.dtColumnsCal= [ DTColumnBuilder.newColumn('name').withTitle('Name') ...

Acquire the value of ant-design Select dropdown upon hover

How can we detect the selected option in an ant-design dropdown when it is hovered? <Select defaultValue="lucy" style={{ width: 120 }} onChange={handleChange}> <Option value="jack">Jack</Option> <Option value=& ...

Troubleshooting React.createElement warning in Jest, Enzyme, and Styled Components integration

After creating styled components in a separate file with the same name and .css.jsx, such as Abc.jsx having Abc.css.jsx and importing it to utilize in Abc.jsx, an error is encountered when attempting to test Abc.jsx using Enzyme mount. Warning: React.creat ...

Updating a child component in React while applying a filter to the parent component

Although I've come across this question before, I'm struggling to comprehend it within my specific scenario. I'm currently using a search bar to filter the data, which is functioning properly. However, the image is not updating. The URL bei ...

How can I utilize the <Collapse> component for transitions with the <Popper> component in order to show a Menu when hovering?

My question pertains to React and Material-UI: I am encountering an issue when using the <Collapse> transition component to display my <Menu> element onMouseEnter. It seems there is a problem with how the <Collapse> component interacts w ...

Organized grid design where every element occupies its own required space

Here's the current image I have displayed: This image is being styled by the following code: .gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); } I've been searching for a solution to make each element only take u ...

What is the process for generating a unique show page based on the clicked item's ID?

As I work on creating a list of items using the .map function, I aim to render each item along with additional details on a single page. import React from 'react' import {faArrowRight, faMusic, faPlay, faPlayCircle, faTachometerAlt} from "@f ...

PHP array manipulation to filter specific elements

In my code, I am using a foreach loop to reorganize data based on location and appointment dates/times: $temp = []; $remappedData=[]; $intCurrentIndex = -1; foreach ($result as $value) { if(isset($temp[$value['Location']] ...

Looking for assistance in streamlining my jQuery code for bootstrap tab pane. Any takers?

Having trouble setting a specific tab as active when navigating from different links. I have found a solution, but it involves writing code for each individual tab. Can someone offer assistance in simplifying the code? <table class="nav nav-tabs"> ...

The stickme package (NodeJS, NPM) does not have any versions currently accessible

Recently, the stickme plugin in my office project was working flawlessly. However, as of last week, it has started failing when I try to build the project. Even attempting to manually install the stickme plugin with npm install stickme results in the foll ...

How can I effectively test the success of a form submission in next.js using jest for unit testing?

At the moment, I am in the process of developing a unit test for a registration form within my application. The main objective of this test is to ensure that the registration process can be executed successfully without actually saving any new data into th ...

Next.js 14 server component is not allowing cookies to be sent to external APIs

I am currently using nextjs 14. Within the dashboard layout file's server component, I have implemented a get request to an API built with .net. The issue at hand is that the cookies set by .net in my browser are not being transmitted to the API side, ...

Tips for sending a form as a PDF attachment through email using Nodemailer, React, and Node.js

Imagine a scenario with a React form. Here's what I envision: fill out the form, click the submit button, and watch as the form magically generates a PDF that gets sent as an attachment via Nodemailer. Sure, I've successfully managed to send emai ...