Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
K
kpp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexandr Veselov
kpp
Commits
e9a94fed
Commit
e9a94fed
authored
Dec 04, 2017
by
Nikolay Gromov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Допиливаю компоненты
parent
50cec550
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
29 deletions
+83
-29
gulpfile.js
gulpfile.js
+9
-0
blocks-library.pug
src/blocks-library.pug
+25
-4
comment.pug
src/blocks/comment/comment.pug
+29
-20
comment.scss
src/blocks/comment/comment.scss
+17
-2
layout.pug
src/pug/layout.pug
+3
-3
No files found.
gulpfile.js
View file @
e9a94fed
...
@@ -395,6 +395,7 @@ gulp.task('html', function() {
...
@@ -395,6 +395,7 @@ gulp.task('html', function() {
gulp
.
task
(
'pug'
,
function
()
{
gulp
.
task
(
'pug'
,
function
()
{
const
pug
=
require
(
'gulp-pug'
);
const
pug
=
require
(
'gulp-pug'
);
const
htmlbeautify
=
require
(
'gulp-html-beautify'
);
const
htmlbeautify
=
require
(
'gulp-html-beautify'
);
const
replace
=
require
(
'gulp-replace'
);
console
.
log
(
'---------- сборка Pug'
);
console
.
log
(
'---------- сборка Pug'
);
// Pug-фильтр, выводящий содержимое pug-файла в виде форматированного текста
// Pug-фильтр, выводящий содержимое pug-файла в виде форматированного текста
...
@@ -425,6 +426,14 @@ gulp.task('pug', function() {
...
@@ -425,6 +426,14 @@ gulp.task('pug', function() {
}))
}))
.
pipe
(
realFavicon
.
injectFaviconMarkups
(
JSON
.
parse
(
fs
.
readFileSync
(
faviconData
)).
favicon
.
html_code
))
.
pipe
(
realFavicon
.
injectFaviconMarkups
(
JSON
.
parse
(
fs
.
readFileSync
(
faviconData
)).
favicon
.
html_code
))
.
pipe
(
htmlbeautify
())
.
pipe
(
htmlbeautify
())
// и... привет бьютификатору!
.
pipe
(
replace
(
/^
(\s
*
)(
<header.+
?
>
)(
.*
)(
<
\/
header>
)
/gm
,
'$1$2
\
n$1 $3
\
n$1$4'
))
.
pipe
(
replace
(
/^
(\s
*
)(
<footer.+
?
>
)(
.*
)(
<
\/
footer>
)
/gm
,
'$1$2
\
n$1 $3
\
n$1$4'
))
.
pipe
(
replace
(
/^
\s
*<section.+>/gm
,
'
\
n$&'
))
.
pipe
(
replace
(
/^
\s
*<
\/
section>/gm
,
'$&
\
n'
))
.
pipe
(
replace
(
/^
\s
*<article.+>/gm
,
'
\
n$&'
))
.
pipe
(
replace
(
/^
\s
*<
\/
article>/gm
,
'$&
\
n'
))
.
pipe
(
replace
(
/
\n\n\n
/gm
,
'
\
n
\
n'
))
.
pipe
(
gulp
.
dest
(
dirs
.
buildPath
));
.
pipe
(
gulp
.
dest
(
dirs
.
buildPath
));
});
});
...
...
src/blocks-library.pug
View file @
e9a94fed
...
@@ -564,13 +564,34 @@ block content
...
@@ -564,13 +564,34 @@ block content
+block-lib('comment', 'Комментарий', false)
+block-lib('comment', 'Комментарий', false)
include:markdown-it(linkify html='true' typographer='true' quotes='«»') blocks/comment/readme.md
include:markdown-it(linkify html='true' typographer='true' quotes='«»') blocks/comment/readme.md
+comment('Джокер', 'img/joker.jpg')
+comment({
p Аватар — не ссылка
username: 'Джокер',
+comment('Джокер', 'img/joker.jpg', '/', 'admin')
avatarURL: 'img/joker.jpg',
p Аватар — ссылка
authorURL: '/users/joker',
content: '<p>Далеко-далеко за словесными горами в стране, гласных и согласных живут рыбные тексты.</p>',
mods: 'admin',
})
+comment({
username: 'Джокер',
content: '<p>Далеко-далеко за словесными горами в стране, гласных и согласных живут рыбные тексты.</p>',
})
+comment({
username: 'Джокер',
content: '<p>Далеко-далеко за словесными горами в стране, гласных и согласных живут рыбные тексты.</p>',
})
+comment({
username: 'Джокер',
content: '<p>Далеко-далеко за словесными горами в стране, гласных и согласных живут рыбные тексты.</p>',
})
+block-lib-code()
+block-lib-code()
include:show-code(first-line="//- Pug-файл этого блока:") blocks/comment/comment.pug
include:show-code(first-line="//- Pug-файл этого блока:") blocks/comment/comment.pug
//- +block-lib('embed-responsive', 'Адаптирующийся медиаконтент', false)
//- include:markdown-it(linkify html='true' typographer='true' quotes='«»') blocks/embed-responsive/readme.md
//- div 111
//- +block-lib-code()
//- include:show-code(first-line="//- Pug-файл этого блока:") blocks/embed-responsive/embed-responsive.pug
.burger.blocks-library__menu-toggler(data-toggle="off-canvas")
.burger.blocks-library__menu-toggler(data-toggle="off-canvas")
...
...
src/blocks/comment/comment.pug
View file @
e9a94fed
//- Все примеси в этом файле должны начинаться c имени блока (comment)
//- Все примеси в этом файле должны начинаться c имени блока (comment)
mixin comment(
username, avatarURL, authorURL, mod
s)
mixin comment(
prop
s)
//- Принимает:
//- Принимает:
//- username {string} - имя пользователя
//- props {object}
//- avatarURL {string} - адрес изображения с аватаром
//- username {string} - имя пользователя
//- authorURL {string} - адрес изображения с аватаром
//- avatarURL {string} - адрес изображения с аватаром
//- mods {string} - список модификаторов
//- authorURL {string} - адрес изображения с аватаром
//- content {string} - html текста коммента
//- mods {string} - список модификаторов
//- Вызов:
//- Вызов:
+comment('Джокер', 'img/joker.jpg')
+comment({
p Текст
username: 'Джокер',
+comment('Джокер', 'img/joker.jpg', '/joker', 'admin')
avatarURL: 'img/joker.jpg',
p Текст
authorURL: '/users/joker',
mods: 'admin',
})
-
-
// список модификаторов
// список модификаторов
var allMods = '';
var allMods = '';
if(typeof(
mods) !== 'undefined' &&
mods) {
if(typeof(
props.mods) !== 'undefined' && props.
mods) {
var modsList = mods.split(',');
var modsList =
props.
mods.split(',');
for (var i = 0; i < modsList.length; i++) {
for (var i = 0; i < modsList.length; i++) {
allMods = allMods + ' comment--' + modsList[i].trim();
allMods = allMods + ' comment--' + modsList[i].trim();
}
}
}
}
if(typeof(props.username) === 'undefined') props.username = 'anonymous';
if(typeof(props.avatarURL) === 'undefined') props.avatarURL = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"%3E%3Ccircle r="50%25" cx="50%25" cy="50%25" fill="#ccc"/%3E%3C/svg%3E';
article.comment(class=allMods)&attributes(attributes)
article.comment(class=allMods)&attributes(attributes)
if(typeof(authorURL) !== 'undefined' && authorURL)
.comment__inner
a.comment__avatar-wrap(href=authorURL)
if(typeof(props.authorURL) !== 'undefined' && props.authorURL)
img(src=avatarURL, alt=username)
a.comment__avatar-wrap(href=props.authorURL)
else
img(src=props.avatarURL, alt=props.username)
span.comment__avatar-wrap
else
img(src=avatarURL, alt=username)
span.comment__avatar-wrap
.comment__body
img(src=props.avatarURL, alt=props.username)
b.comment__author= username
.comment__text
block
header.comment__header #[b.comment__author= props.username] #[time.comment__date(datetime='2017-04-25T05:45') 25.04.2017 в 05:45]
.comment__body!= props.content
footer.comment__footer #[a.comment__reply(href='') Reply] #[a.comment__reply(href='') Admin]
block
src/blocks/comment/comment.scss
View file @
e9a94fed
...
@@ -6,10 +6,21 @@
...
@@ -6,10 +6,21 @@
$block-name
:
&
;
// #{$block-name}__element
$block-name
:
&
;
// #{$block-name}__element
display
:
flex
;
margin-top
:
$line-height
;
margin-top
:
$line-height
;
margin-bottom
:
$line-height
;
margin-bottom
:
$line-height
;
&
&
{
padding-left
:
calc
(
60px
+
1em
);
}
&
&
&
&
{
padding-left
:
0
;
}
&
__inner
{
display
:
flex
;
}
&
__avatar-wrap
{
&
__avatar-wrap
{
flex-shrink
:
0
;
flex-shrink
:
0
;
margin-right
:
1em
;
margin-right
:
1em
;
...
@@ -22,11 +33,15 @@
...
@@ -22,11 +33,15 @@
}
}
}
}
&
__
body
{
&
__
text
{
flex-grow
:
1
;
flex-grow
:
1
;
*
:first-child
{
*
:first-child
{
margin-top
:
0
;
margin-top
:
0
;
}
}
}
}
&
__header
{}
&
__footer
{}
}
}
src/pug/layout.pug
View file @
e9a94fed
...
@@ -28,12 +28,12 @@ html(class="no-js page", lang="ru")
...
@@ -28,12 +28,12 @@ html(class="no-js page", lang="ru")
div.page__inner
div.page__inner
div.page__content
div.page__content
block header
block header
div header
header.page-header «шапка»
block content
block content
div
content
div
содержимое страницы
div.page__footer-wrapper
div.page__footer-wrapper
block footer
block footer
div подвал
footer.page-footer «подвал»
div.off-canvas__overlay(data-toggle="off-canvas")
div.off-canvas__overlay(data-toggle="off-canvas")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment