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 { htmlToElement } from './utils'; | |
export default class App { | |
constructor() { | |
this.input = document.getElementById('input'); | |
this.listRoot = document.getElementById('list-root'); | |
// Clone node and its decendants into class property. | |
this.emptyState = document.getElementById('empty-state').cloneNode(true); |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>ES6 Todo List</title> | |
</head> | |
<body class="bg-gray-700"> | |
<div class="w-full max-w-lg mt-16 mx-auto"> |
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 { htmlToElement } from './utils'; | |
export default class App { | |
//... | |
addNewItem(itemName) { | |
//... | |
const item = htmlToElement(` | |
//... |
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 { htmlToElement } from './utils'; | |
export default class App { | |
//... | |
addNewItem(itemName) { | |
//... | |
const item = htmlToElement(` | |
<li class="flex py-4 border-b border-gray-900"> | |
<-- ... --> |
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 '../main.css'; | |
import App from './app'; | |
document.addEventListener('DOMContentLoaded', () => { | |
const app = new App(); | |
}); |
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 MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
module.exports = { | |
entry: './src/js/main.js', | |
mode: 'development', | |
plugins: [ | |
new MiniCssExtractPlugin({ | |
filename: '[name].css', |
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'); | |
module.exports = { | |
entry: './src/js/main.js', | |
mode: 'development', | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
filename: 'index.html', | |
template: 'src/index.html' |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>ES6 Todo List</title> | |
</head> | |
<body class="bg-gray-700"> | |
<div class="w-full max-w-lg mt-16 mx-auto"> |
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'); | |
module.exports = { | |
entry: './src/js/main.js', | |
mode: 'development', | |
output: { | |
filename: 'index.js', | |
path: path.resolve(__dirname, 'dist') | |
} | |
}; |
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
module.exports = { | |
entry: './src/styles.css', | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/, | |
use: ExtractTextPlugin.extract({ | |
use: [ | |
{ loader: 'css-loader', options: { importLoader: 1 } }, | |
'postcss-loader' |