added lab5

This commit is contained in:
2025-11-28 00:47:07 +10:00
parent dc039301f6
commit d468d0efb4
21 changed files with 6994 additions and 0 deletions

1
labs/lab5/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

6695
labs/lab5/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

30
labs/lab5/package.json Normal file
View File

@@ -0,0 +1,30 @@
{
"name": "template_pug",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --mode production",
"serve": "webpack serve --open --mode development",
"dev": "webpack --mode development",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chokidar": "^4.0.3",
"css-loader": "^6.8.1",
"filemanager-webpack-plugin": "^8.0.0",
"glob": "^11.0.3",
"html-webpack-plugin": "^5.5.3",
"pug": "^2.0.4",
"pug-loader": "^2.4.0",
"style-loader": "^3.3.3",
"stylus": "^0.61.0",
"stylus-loader": "^7.1.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
}
}

View File

@@ -0,0 +1,36 @@
block variables
- var title = 'Самые высокие здания и сооружения'
-
var dictMenu = {'Главная': 'index.html',
'Небоскребы' : "#",
'Башни': "#",
'Список': "#"
}
- var listImages = ['image1.jpg', 'image2.jpg', 'image3.jpg', 'image4.jpg', 'image5.jpg']
-
var listSections = [
{'header' : 'Бурдж-Халифа в Дубае, ОАЭ',
'image' : 'image7.jpg',
'text' : 'Небоскрёб высотой 828 метров, самое высокое сооружение в мире. Форма здания напоминает сталагмит.'
},
{'header' : 'Токийское небесное дерево, Япония',
'image' : 'image6.jpg',
'text' : 'Телевизионная башня в районе Сумида самая высокая среди телебашен мира. Высота телебашни вместе с антенной составляет 634 метра.'
},
{'header' : 'CN Tower, Канада',
'image' : 'image8.jpg',
'text' : 'Си-Эн Тауэр — самое высокое свободно стоящее сооружение в мире с 1976 по 2007 год. Его высота составляет 553,33 метра.'
}
]
-
var structures = [
{
menuItem: "Ворота Запада, США",
pict: "image1_big.jpg",
firstP: `Арка в Сент-Луисе, также известная под именем «Врата на запад» — мемориал, являющийся частью Джефферсоновского национального экспансиального мемориала, а также визитной карточкой Сент-Луиса, штат Миссури, США.`,
secondP: `Арка была спроектирована финско-американским архитектором Ээро Саариненом в 1947 году. Её высота 192 метра в самой высокой точке, ширина её основания также 192 метра.
Таким образом арка является самым высоким памятником на территории США. Её строительство началось 12 февраля 1963 года и было закончено 28 октября 1965 года. Памятник открылся для посетителей 24 июля 1967 года.`
}
]

View File

@@ -0,0 +1,2 @@
h2= 'Hello World!'
img(src= require("../images/img1.jpg"))

View File

@@ -0,0 +1,20 @@
include ../components/data.pug
mixin createMenu(menu, active)
each value, key in menu
if active == key
a.active(href= value)= key
else
a(href= value)= key
mixin createMenuBuild(menu, active)
each value, key in menu
a(href= value)= key
a.active(href= "")= active
mixin createSection()
each item in listSections
section
h3= item.header
img(src= require("../images/" + item.image))
p= item.text
a(href="#") …

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

1
labs/lab5/src/index.js Normal file
View File

@@ -0,0 +1 @@
import './styles/main.styl'

View File

@@ -0,0 +1,19 @@
extends template
block nav
title #{structures[0].menuItem}
nav
+createMenuBuild(dictMenu, structures[0].menuItem)
block header
h2= structures[0].menuItem
block content
img.big(src= require("../images/" + structures[0].pict))
section
p= structures[0].firstP
p= structures[0].secondP

View File

@@ -0,0 +1,19 @@
extends template
block nav
nav
+createMenu(dictMenu, 'Главная')
block content
div.images
each pict in listImages
a(href= "building.html")
img(src= require("../images/" + pict))
article
each item in listSections
section
h3= item.header
img(src= require("../images/" + item.image))
p= item.text
a(href="#") …

View File

@@ -0,0 +1,18 @@
include ../components/mixin.pug
include ../components/data.pug
doctype html
html(lang="ru")
head
title #{title}
body
block header
h2= title
block nav
block content
block footer
footer
h4 © Пример html-страницы

View File

@@ -0,0 +1,84 @@
colorText = #6f6d6d
back(size)
background-color #f1f1f1
box-shadow 4px 5px 10px rgba(0, 0, 0, 0.4)
padding: size + "%"
margin 0 0 1% 0
html
color colorText
nav
back(0)
text-align right
& a
display inline-block
padding 1%
color colorText
text-decoration: none
&:hover
&.active
background-color #f87777
color #f8f8f8
div.images
display grid
grid-template-columns repeat(5, 1fr)
grid-gap 0.5%
back(1)
& img
width: 100%
@media (max-width: 600px)
grid-template-rows repeat(5, 1fr)
grid-template-columns 1fr
& img
width 80%
margin auto
article
width 80%
margin auto
display grid
grid-template-columns repeat(3, 1fr)
grid-gap 4%
@media (max-width: 600px)
grid-template-rows repeat(3, 1fr)
grid-template-columns 1fr
& section
display grid
grid-template-columns 1fr 2fr
grid-gap 2%
align-items center
back(2)
& h3
grid-column 1/3
margin 0
text-align center
& img
width: 100%
footer
background-color colorText
color white
@media (max-width: 600px)
margin 3vh 0
& h4
padding:10px
.big
width 50vw
@media (max-width: 600px)
width 100vw
section
display grid
grid-template-columns 1fr 1fr
@media (max-width: 600px)
grid-template-columns 1fr

View File

@@ -0,0 +1,69 @@
const HtmlWebpackPlugin = require("html-webpack-plugin");
const FileManagerPlugin = require("filemanager-webpack-plugin");
const path = require("path");
const fs = require("fs");
const pagesDir = path.join(__dirname, "src", "pages");
const pages = fs.readdirSync(pagesDir).filter(file => file.endsWith(".pug"));
module.exports = {
output: {
path: path.join(__dirname, "dist"),
filename: "index.[contenthash].js",
assetModuleFilename: path.join("images", "[name].[contenthash][ext]"),
},
entry: path.join(__dirname, "src", "index.js"),
module: {
rules: [
{
test: /\.pug$/,
loader: "pug-loader",
},
{
test: /\.(png|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
{
test: /\.svg$/,
type: "asset/resource",
generator: {
filename: path.join("icons", "[name].[contenthash][ext]"),
},
},
{
test: /\.styl$/,
use: [
{
loader: "style-loader",
},
{
loader: "css-loader",
},
{
loader: "stylus-loader",
},
],
},
],
},
plugins: [
...pages.map(
(page) =>
new HtmlWebpackPlugin({
template: path.join(pagesDir, page),
filename: page.replace(".pug", ".html"),
})
),
new FileManagerPlugin({
events: {
onStart: {
delete: ["dist"],
},
},
}),
],
devServer: {
watchFiles: path.join(__dirname, "src"),
port: 9000,
},
};