Integrating foundation-sites with webpack, unable to apply styles

Delving into the world of webpack for the first time has been quite a daunting experience! I'm attempting to set up the foundation for sites, but I feel completely lost when it comes to configuring it properly.

Here is my Webpack configuration:

var webpack = require('webpack');
var path = require('path');

var config = {
    entry: './src/client/app/index.jsx',
    output: {
        path: __dirname + '/src/client/public/',
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                test: /\.(js|jsx)$/,
                include: __dirname + '/src/client/app',
                exclude: /node_modules/,
                loader: 'babel-loader'
            },
            {
                test: /\.(css|scss)$/,
                loader: 'sass-loader'
            }
        ]
    }
};

module.exports = config;

A snippet from master.scss:

@import "foundation";

@include foundation-everything;

Below is my directory structure:

https://i.stack.imgur.com/06SuL.png

Although the web app is functioning correctly, I am facing issues with rendering:

import React from 'react';
import {render} from 'react-dom';

import './styles/navigation.scss';

export default class Navigation extends React.Component {
    render() {
        return (
            <div className="top-bar topbar-background">
                <div className="top-bar-left">
                    <ul className="menu">
                        <li className="menu-text">App</li>
                        <li><a href="/">Home</a></li>
                        <li><a href="/services">Services</a></li>
                    </ul>
                </div>
                <div className="top-bar-right">
                    <ul className="menu">
                        <li><a href="/login">Login/Register</a></li>
                        <li><a href="/terms">Terms</a></li>
                    </ul>
                </div>        
            </div>
        )
    }
}

I am seeing unappealing list items in outdated HTML format. Can you spot what I might be doing incorrectly?

Additional information: The foundation-sites package was installed using npm.

Answer №1

If you're looking to streamline your Webpack setup, consider using the Webpack foundation-sites loader.

Here is a sample webpack configuration that demonstrates how to set it up:

module.exports = {
  module: {
    loaders: [
      // Make sure each Foundation JS file required by foundation-webpack can access the jQuery object
{ test: /foundation\/js\//, loader: 'imports?jQuery=jquery' }
    ]
  }
};

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

Exploring the capabilities of the Next.js router and the useRouter

import { routeHandler } from "next/client"; import { useRouteNavigator } from "next/router"; const CustomComponent = () => { const routerFromHook = useRouteNavigator(); } export default CustomComponent; Can you explain the disti ...

How can I make my Grid items in React and Material-UI occupy the entire horizontal space without wrapping to the next row?

I am currently utilizing Material-UI within a React 16.10 project. My goal is to create a table where the left column consists of an icon, while the right column displays a label and address stacked on top of each other. I want the items in the right colum ...

Executing a Cron Job several times daily, each and every day

This is my current code snippet: const CronJob = require('cron').CronJob; new CronJob({ cursoronTime: '* * * * *', // every minute onTick: async function() { console.log(&ap ...

Creating React Context Providers with Value props using Typescript

I'd prefer to sidestep the challenge of nesting numerous providers around my app component, leading to a hierarchy of provider components that resembles a sideways mountain. I aim to utilize composition for combining those providers. Typically, my pro ...

What is the best way to increase padding in a Vuetify view element?

I have been attempting to increase the padding of my view by utilizing the "px-5" class on the container within the view. However, I am struggling to achieve the desired amount of padding. What I am aiming for is padding similar to what is shown in this sc ...

Exploring Typescript within React: Creating a property on the current instance

Within my non-TypeScript React component, I previously implemented: componentWillMount() { this.delayedSearch = _.debounce((val) => { this.onQuerySearch(val); }, 1000); } This was for debouncing user input on an input field. The corres ...

Looking for guidance on using text2wav.node.js? The audio quality seems to be lacking clarity

I've been working with this module and my code to save it to the project directory is quite simple. However, I'm facing issues with unclear sounds and difficulty understanding it. Could there be an error in my approach? async function Final() { ...

The combination of useEffect and Client component has the power to greatly

As a newcomer to React development, I've encountered a blocking error in my code that isn't being detected by Visual Studio Code. Here's the code snippet for my NavBar component: import React, { useState, useEffect } from "react"; import Ima ...

Custom input field in Material UI not communicating properly with Redux form

I am currently utilizing Material UI and React to implement a custom input field. While using redux form for form validation, I have encountered an issue where the onBlur and onFocus events are not being dispatched successfully. Interestingly, if I switch ...

Using animation.width() in Javascript to create a countdown

Currently, I am working on creating a visual countdown for my users to indicate when an animation will finish. The code snippet below shows my initial attempt: function setClassAndFire(){ timer = setInterval(function () { t--; ...

Node.js producing several asynchronous responses

In my current project with a node.js app, the goal is to send a large amount of data from various sources to the user's dashboard upon login. To prevent holding up the response until all the information is retrieved from the database, I am experiment ...

Error: You are not able to utilize an import statement outside of a module when utilizing the `fast-image-zoom` feature

Currently, I am attempting to integrate fast-image-zoom into my React/Next.js application and unfortunately encountering an error message that reads: SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:353:18) ...

Utilizing React Router with a specified basename allows for routes to be matched even when they do

I am looking to deploy my application from a specific subdirectory, such as localhost:3000/test. This way, I intend for the routes tab1 and tab2 to be accessible at localhost:3000/test/tab1 and localhost:3000/test/tab2. To accomplish this, I experimented ...

What is the recommended method for implementing ReactCSSTransitionGroup?

Does anyone have advice on how to implement a simple CSS fade in for pages without encountering Failed PropType errors? I've been adding tons of timeout props to avoid them, but it seems like this method may not be supported in future versions of Reac ...

Convert a variable's value into its corresponding variable name for the purpose of utilizing it in destructuring assignment

Within my models folder, there is an index.js file structured like this: 'use strict'; const {Dest1} = require('./destinations/dest1'); const {Dest2} = require('./destinations/dest2'); module.exports = {Dest1, Dest2}; I am i ...

Ways to conceal the scroll bar upon the initial loading of a webpage

Recently, I created a single-page website consisting of 4 sections. The client has specific requirements that need to be fulfilled: The scrollbar should not be visible when the page loads. Once the user starts scrolling past the second section, the scrol ...

Are there any methods available to adjust the size of a View component in react-native?

My react-native application includes a View that contains several components. The layout displays perfectly on iPhone 6 and 5 models, but on an iPhone 4s, the bottom of one component is being clipped slightly. I'm aware of scaling base64 icons, but I ...

Discovering the best approach to utilizing Font Awesome 6 with React

Required Packages "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/free-solid-svg-icons": "^6.1.1", "@fortawesome/react-fontawesome": "^0.1.18", "next": " ...

Node.js is struggling to parse JSON data, resulting in undefined values appearing in the console

Issue with parsing JSON data in a node.js environment resulting in 'undefined' display in console. Below is the HTML code snippet: var jsonObjects = [{id:1, name:"amit"}]; jQuery.ajax({ url: 'http://localhost:8081', type: ...

Protected node.js REST API

I want to ensure the security of a restful API and aim to keep it simple and stateless. What is the best way to store, generate, and authenticate API keys? I was considering using node-uuid to generate keys, storing them in Redis, and then authenticating ...