Overview
I'm working on a website (multi-page) for a friend and I've decided to use Google's Material Design Components (MDC) for the Web as the base of its styling. I would like for it to be hosted on Firebase, using Functions and Hosting.
I have been working on it for a little more than a week and have gotten to the point where I can use Node.js, Express, and EJS to render multiple pages, but I can't seem to understand how MDC would become functional in this environment.
Question
Have you seen this work before? If so, how was it done and where should I begin?
Side-Note
I have been able to get it to run locally using this quide. Here's the main files that make this work:
webpack.config.js
module.exports = [{
entry: './app.scss',
output: {
// This is necessary for webpack to compile
// But we never use style-bundle.js
filename: 'style-bundle.js',
},
module: {
rules: [{
test: /\.scss$/,
use: [
{
loader: 'file-loader',
options: {
name: 'bundle.css',
},
},
{ loader: 'extract-loader' },
{ loader: 'css-loader' },
{
loader: 'sass-loader',
options: {
includePaths: ['./node_modules']
}
},
]
}]
},
}];
index.html
<html>
<head>
<link rel="stylesheet" href="bundle.css">
</head>
<body>
<button class="foo-button mdc-button">
Button
</button>
</body>
</html>
package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "webpack-dev-server",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"@material/button": "^0.36.0",
"firebase-admin": "~5.12.1",
"firebase-functions": "^1.0.3"
},
"devDependencies": {
"css-loader": "^0.28.11",
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0",
"extract-loader": "^2.0.1",
"file-loader": "^1.1.11",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.3",
"webpack": "^3.12.0",
"webpack-dev-server": "^2.11.2"
},
"private": true
}
app.scss
@import "@material/button/mdc-button";
.foo-button {
@include mdc-button-ink-color(teal);
@include mdc-states(teal);
}