Skip to content

ghost-goblin/restaurant-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Restaurant Page - Odin Project

πŸ• Live Project πŸ‘‰ here

πŸ““ Webpack Guide

mkdir new-site
cd new-site
  1. run npm init -y in the project directory to generate a package.json file
  2. run npm install webpack webpack-cli --save-dev to install webpack to the node_modules directory of your project
  3. Add a .gitignore file to your project and add node_modules/: echo node_modules/ >> .gitignore
  4. Create a webpack.config.js file (echo "config here" >> webpack.config.js) that looks this:
const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
};

OPTIONAL Add a README.md file: echo # New Site Title >> README.md

  1. Create a src and dist directory: mkdir src dist
  • An index.js file in src
cd src
echo alert('Congratulations'); >> index.js
  • An index.html file in dist
cd..
cd dist
echo "" >> index.html
echo "" >> style.css

Directory Structure

+---dist
|   |   index.html
|   |   main.js
|   |   style.css
+---node_modules
+---src
|   |   index.js
|   |   module01.js
+---.gitignore
+---package-lock.json
+---package.json
/---webpack.config.js
  1. Link the main.js file in a script tag <script src="main.js"></script> in dist\index.html
  2. Your dist\index.html should look like this:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>New Site Title</title>
</head>
<body>
    <script src="main.js"></script>   
</body>
</html>

FYI main.js is the file that will be generated by webpack, do not touch this file!

  1. run npx webpack

Hot Tip πŸ”₯: if you run npx webpack --watch, you will not have to rerun webpack every time you make a change


  1. git add dist && git commit -m "Initial dist subtree commit"
  2. git subtree push --prefix dist origin gh-pages

About

πŸ•πŸ˜€ Restaurant site with dynamic tabbed browsing functionality

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published