My stack is Horizon + React. I want to use foundation 6 on my client side. I use webpack for my js, but when I try to use it with css, I get only the comment from the foundation css but no css.
My files are:
webpack.config.js:
const path = require('path');
var config = {
context: __dirname + "/src",
entry: "./js/main.js",
output: {
filename: "bundle.js",
path: __dirname + "/dist"
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015']
}
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
}
]
},
resolve: {
modulesDirectories: ['./node_modules']
},
};
module.exports = config;
main.scss:
@import "../../node_modules/foundation-sites/scss/foundation";
main.js:
...
//adding css
require("../css/main.scss");
...
On the webpage i see only:
/**
* Foundation for Sites by ZURB
* Version 6.2.3
* foundation.zurb.com
* Licensed under MIT Open Source
*/
So what am I doing wrong?
You need to @include
the pieces you want to use. For example, to include everything:
@include foundation-everything;
Relevant docs are here:
Bonus tip: Webpack allows you to use ~
to import from module directories:
@import "~foundation-sites/scss/foundation";
@include foundation-everything;