This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const HtmlWebPackPlugin = require("html-webpack-plugin"); | |
const getFilesFromDir = require("./config/files"); | |
const PAGE_DIR = path.join("src", "pages", path.sep); | |
const htmlPlugins = getFilesFromDir(PAGE_DIR, [".html"]).map( filePath => { | |
const fileName = filePath.replace(PAGE_DIR, ""); | |
return new HtmlWebPackPlugin({ | |
chunks:[fileName.replace(path.extname(fileName), ""), "vendor"], | |
template: filePath, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const path = require("path"); | |
function getFilesFromDir(dir, fileTypes) { | |
const filesToReturn = []; | |
function walkDir(currentPath) { | |
const files = fs.readdirSync(currentPath); | |
for (let i in files) { | |
const curFile = path.join(currentPath, files[i]); | |
if (fs.statSync(curFile).isFile() && fileTypes.indexOf(path.extname(curFile)) != -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import Menu from "components/Menu"; | |
ReactDOM.render(<Menu/>, document.getElementById("menu")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Home Page</title> | |
</head> | |
<body> | |
<div id="menu"></div> | |
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. </p> | |
</body> |