Setting up the perfect environment with Vue.js, Foundation, and Webpack integration

I've been working on integrating the foundation.css file into my Vue webpack application. To achieve this, I first installed foundation using:

- npm install foundation-sites.

Then, I proceeded to install the extract text plugin with the following commands:

-- npm install extract-text-webpack-plugin 
--save-dev.

However, I am now faced with uncertainty regarding the next steps in the process.

In the APP.vue file, you can find the following code snippet:

<template>
<div id="app">
<img src="./assets/logo.png">
<hello></hello>
</div>
</template>

<script>
import Hello from './components/Hello'

export default {
name: 'app',
components: {
Hello
}
}
</script>

<style>
import '../node_modules/foundation-sites/dist/foundation.css'
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
 text-align: center;
 color: #2c3e50;
 margin-top: 60px;
 }
 </style>

As for the Webpack.config.js configuration, it includes the following setup:

[Webpack config details here]

I added a reference to the foundation CSS file in the index.html like so:

`<link rel="stylesheet" href="node_modules/foundation-sites/dist/foundation.css"> ` 

Despite trying different approaches, nothing seems to reflect when inspecting the source after deploying the app live.

An update - I encountered the following error in the terminal:

[Error details here]

Answer №1

The reason why the foundation CSS is not loading is due to the lack of a CSS loader assigned to it

import '../node_modules/foundation-sites/dist/foundation.css'.

To resolve this issue, you will need to use something similar to the following:

require("!style!css!sass!../node_modules/foundation-sites/dist/foundation.css");

Answer №2

@floatingClouds :
I noticed that the project was initialized using vue-cli, which means the css-loader is already set up.
loaders: utils.cssLoaders() will handle the configuration of css-loader in webpack.

@serenekjs9834 :
The statement import 'xxx.css' should be placed within either <script>..</script> or a file with the extension *.js.
It is advisable to include this line in main.js (the primary JavaScript file for your project).
Importing css within the <style>...</style> section is incorrect.

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

Retrieving Numbers from Message Content in Discord.js

Today I attempted to create a bot and wanted to extract a number from the user's message. Here is what I tried: Client.on ("message", (message) => { if (message.author.bot) return; if (message.content.startsWith(Config.prefix + & ...

Illuminating Wireframes with Three.js MeshPhongMaterial

While attempting to display a mesh with Phong shading along with wireframe on an ArrayBufferGeometry where the vertex colors are set to THREE.vertexColors, I encountered an issue where the lighting only affects one random face. However, when I switch to Me ...

Is there a way to access the pixel data of a scene in Three.js without having to render it on the canvas?

Is there a way to obtain the pixel data (in the form of an array buffer) that would be displayed on a canvas if I were to render a scene, without actually rendering it on the canvas? If so, how can this be achieved? I have not written any code for this ye ...

How can you efficiently update another ng-model value based on a select input in AngularJS using ng-change?

<select data-ng-init="selectedItem='previewWidth = 1920; previewHeight = 1080'" data-ng-model="selectedItem" data-ng-change="GetNewData(); {{selectedItem}}"> <option value="previewWidth = 1920; previe ...

Submitting form data using Vue and PHPMailer

I've been encountering an issue with submitting a contact form from a page. After submitting the form, nothing seems to happen. My tech stack includes Vue, Axios, and PHPMailer for handling this functionality. Upon inspecting the network tab, it appea ...

Storing Backbone collection data retrieved from a JSON file and persisting it in local storage

I recently started working with the backbone library and exploring building a mobile application using backbone, requirejs, and jquery-mobile. I've successfully populated my collection with data from a local JSON file (with plans to eventually retriev ...

Delete progeny from Object3D

If I were to instantiate objects using the code below: const group = new THREE.Object3D(); for (let i = 0; i < 10; i++) { const geometry = new THREE.BoxGeometry(1, 1, 1); const material = new THREE.MeshNormalMaterial(); const mesh = new T ...

Express.JS failing to save data to file when using NeDB

Currently, I am developing a bulk import feature for my personal password manager and I have encountered a problem. The issue arises when trying to import an array of passwords using the forEach() method to iterate through each one. After calling the inse ...

Tips for dynamically passing a string into a Javascript function

Here is a JavaScript function that I have: function doIt(link) { alert(link); } I am using this function in the following JavaScript code snippet. Here, I am dynamically creating an anchor tag and appending it to my HTML page: jQuery.each(data, func ...

How do I retrieve and display all the locally stored variables in Angular 2/JavaScript and calculate the total number of keys present in the localStorage?

Currently, I'm developing a project in Angular2 that involves the storage of user-added items to a shopping cart. To accomplish this, I have opted to utilize local storage to temporarily save the items. Each category (such as shoes, clothes, etc.) is ...

Building dynamic 3D scenes using JSONLoader in Three.js and Angular4

Having trouble integrating a JSON file into an Angular 4 environment using a JSONLoader. The path to the JSON file is correct, but I can't add it to the scene. I'm receiving an error "cannot set property 'mesh' of undefined" on the line ...

When using React, the event.target method may unexpectedly return the innerText of a previously clicked element instead of the intended element that was

I have implemented a drop-down menu that triggers an event handler to return the selected option when it is clicked. Upon clicking on an option, I retrieve the inner text of that option using the event. The code snippet looks like this: event.target.inner ...

Creating engaging video call games using React-Native

I need assistance with developing a react-native video call app using agora.io. I want to incorporate interactive games for users to play during the calls, similar to those available on Facebook messenger. Can anyone point me towards helpful resources or t ...

Leverage moment.js for formatting dates within a Vue component

I am currently working on a Vue component that includes an input field with a date type: <input type="date" name="start_date" id="start_date" v-model="absence.start_date" > Within my script, I ...

Including a Pinterest image hover widget following the completion of an Ajax load

I have implemented the Pinterest image hover widget on my website to allow users to easily pin images to their Pinterest accounts. You can find the widget here. (Make sure to click the image hover radio button under button type to see the one I am using.) ...

Using Django Sessions for User Authentication in React Applications

Not a coding query, but rather a general one: When using default authentication in Django (session authentication), what does the frontend (in my case it's React) require? For instance, upon logging in on the browser via the front end login button, th ...

Can anyone guide me on creating a Mapbox map layer using React.js?

I'm currently in the process of creating a polygon layer on top of my Mapbox map using ReactMapboxGL. I have some Mapbox Javascript code that I need to convert into React.js format: map.on('load', function () { map.addLayer({ ...

The custom button feature is unresponsive to the enter key

Within my Angular project, I have implemented a custom button component that serves as a submit-form-button across various sections of the application. The issue arises when attempting to submit any form on the website using the enter key while focused on ...

When a user clicks on a button, AJAX and jQuery work together to initiate a setInterval function that continually

Currently, I have two scripts in place. The first script is responsible for fetching a specific set of child nodes from an XML file through AJAX and using them to create a menu displayed as a list of buttons within #loadMe. What's remarkable about thi ...

How to Make an Element Fade Out After Adding a Class in JQuery

I'm struggling with fading out an image after applying a tilt class to it. The transition doesn't seem to work properly and the image just disappears without the expected animation. The class I'm trying to add simply tilts the image 90 degr ...