I’m pretty new to web development and I’m trying to build a static blog from scratch with Hugo, in which I wanna use Google’s Material Design Components.
They recommend using their node modules and bundling the Sass & JS using Webpack in their “Getting Started” page.
The steps on that page (and their Codelabs Tutorial) don’t work out right away, so I tried to learn some Webpack basics, and managed to write this webpack.config.js
which makes the components work (i.e., in a basic static site without Hugo):
const path = require("path");
const autoprefixer = require("autoprefixer");
const loader = require("sass-loader");
module.exports = {
entry: "./src/index.js",
devServer: {
static: "./dist",
},
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [autoprefixer()],
},
},
},
{
loader: "sass-loader",
options: {
implementation: require("sass"),
webpackImporter: false,
sassOptions: {
includePaths: ["./node_modules"],
},
},
},
],
},
],
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
clean: true,
},
};
I decided to set up a project with Hugo, npm, and Webpack. But I’m using npm ONLY for using those Material Design Components, and Webpack seems like overkill, given that the rest of my site functions perfectly using Hugo Pipes.
Question: How do I use MDC components in a Hugo project?
(i.e., is it possible to do what this webpack.config.js
does by only using Hugo Pipes?)
Can someone please guide me on how to do it (or give any alternatives)? Sorry for the long post, and sorry if this is a noob question.