const popupButtonAdd = popupAddCard.querySelector('.popup__button')
const inputAddName = document.querySelector('.popup__input_type_card-name').value
const inputAddUrl = document.querySelector('.popup__input_type_url').value
popupButtonAdd.addEventListener('click', (evt) => {
evt.preventDefault()
document.querySelector('.popup__input_type_card-name').value = '';
document.querySelector('.popup__input_type_url').value = '';
const placesList = document.querySelector('.places__list')
const cardContentNewCard = document.querySelector('.card').cloneNode(true)
cardContentNewCard.querySelector('.card__image').textContent = inputAddName
cardContentNewCard.querySelector('.card__title').src = inputAddUrl
placesList.prepend(cardContentNewCard);
})
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
publicPath: '',
},
mode: 'development',
devServer: {
static: path.resolve(__dirname, './dist'),
open: true,
compress: true,
port: 8081
},
module: {
rules: [{
test: /\.js$/,
use: 'babel-loader',
exclude: '/node_modules/'
},
{
test: /\.(png|svg|jpg|gif|woff(2)?|eot|ttf|otf)$/,
type: 'asset/resource',
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, {
loader: 'css-loader',
options: {
importLoaders: 1
}
},
'postcss-loader'
]
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new CleanWebpackPlugin(),
new MiniCssExtractPlugin(),
]
}