Skip to content

Commit 692c035

Browse files
committed
first commit
0 parents  commit 692c035

17 files changed

+229
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = crlf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.styl]
12+
indent_size = 3

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.idea
3+
package-lock.json

gulpfile.js

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
//установка нового: заходим в директорию и npm install
2+
//Сборка проекта: gulp production
3+
//Запуск gulp'а: gulp watch
4+
'use strict';
5+
var gulp = require('gulp'),
6+
stylus = require('gulp-stylus'),
7+
browserSync = require('browser-sync'),
8+
concat = require('gulp-concat'),
9+
uglify = require('gulp-uglifyjs'),
10+
cssnano = require('gulp-cssnano'),
11+
rename = require('gulp-rename'),
12+
imagemin = require('gulp-imagemin'),
13+
pngquant = require('imagemin-pngquant'),
14+
cache = require('gulp-cache'),
15+
autoprefixer = require('gulp-autoprefixer');
16+
17+
//Browser sync
18+
gulp.task('browser-sync', function(){
19+
browserSync({
20+
server: {
21+
baseDir: 'production'
22+
},
23+
notify: false
24+
});
25+
});
26+
27+
//Assembly of pictures
28+
gulp.task('compress', function() {
29+
gulp.src('src/img/*')
30+
.pipe(imagemin())
31+
.pipe(gulp.dest('production/img/'))
32+
});
33+
34+
35+
36+
//compile and assembly stylus
37+
gulp.task('compile_stylus', function() {
38+
gulp.src('src/css/main.styl')
39+
40+
.pipe( stylus() )
41+
.pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { //Добавление префиксов
42+
cascade: true
43+
}))
44+
.pipe(cssnano())
45+
.pipe( gulp.dest('production/css/') );
46+
});
47+
48+
//compile and assembly twig
49+
gulp.task('compile_twig', function () {
50+
var twig = require('gulp-twig');
51+
return gulp.src('src/html/index.twig')
52+
.pipe(twig({
53+
data: {
54+
title: 'Gulp and Twig',
55+
benefits: [
56+
'Fast',
57+
'Flexible',
58+
'Secure'
59+
]
60+
}
61+
}))
62+
.pipe(gulp.dest('production/'));
63+
});
64+
65+
//Assembly js lib file
66+
gulp.task('compile_lib_js', function () {
67+
gulp.src('src/js/lib/*')
68+
.pipe( gulp.dest('production/js/') );
69+
});
70+
71+
//Assembly my js file
72+
gulp.task('compile_js', function () {
73+
gulp.src('src/js/mvc/**/*.js')
74+
.pipe(concat('main.js'))
75+
.pipe( gulp.dest('production/js/') )
76+
});
77+
78+
//function watch
79+
var watch = ['browser-sync', 'compile_stylus', 'compile_twig','compile_lib_js', 'compile_js', 'compress'];
80+
//Main function watch change file
81+
gulp.task('watch', watch, function() {
82+
gulp.watch('src/css/**/*.styl', ['compile_stylus'], browserSync.reload);
83+
gulp.watch('src/html/**/*.twig', ['compile_twig'], browserSync.reload);
84+
gulp.watch('src/js/common/*.js', ['compile_js'], browserSync.reload);
85+
gulp.watch('src/js/lib/*', ['compile_lib_js'], browserSync.reload);
86+
gulp.watch('src/img/*', ['compress'], browserSync.reload);
87+
});
88+
89+
//Assembly project
90+
var complete = ['compile_stylus', 'compile_twig', 'compile_js','compile_lib_js', 'compress' ];
91+
gulp.task('production', complete, function () {
92+
93+
});
94+
95+
96+

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "education",
3+
"version": "1.0.0",
4+
"description": "my gulp",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "Spirit04eK",
10+
"license": "ISC",
11+
"devDependencies": {
12+
"browser-sync": "^2.18.13",
13+
"del": "^3.0.0",
14+
"gulp": "^3.9.1",
15+
"gulp-autoprefixer": "^4.0.0",
16+
"gulp-cache": "^0.5.0",
17+
"gulp-concat": "^2.6.1",
18+
"gulp-cssnano": "^2.1.2",
19+
"gulp-imagemin": "^3.4.0",
20+
"gulp-rename": "^1.2.2",
21+
"gulp-sass": "^3.1.0",
22+
"gulp-stylus": "^2.7.0",
23+
"gulp-twig": "^1.2.0",
24+
"gulp-uglifyjs": "^0.6.2",
25+
"imagemin-pngquant": "^5.0.1",
26+
"sass": "^1.0.0-beta.2"
27+
},
28+
"dependencies": {}
29+
}

src/.DS_Store

6 KB
Binary file not shown.

src/css/.DS_Store

6 KB
Binary file not shown.

src/css/base/reset.styl

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
html, body, div, span, applet, object, iframe,
2+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3+
a, abbr, acronym, address, big, cite, code,
4+
del, dfn, em, img, ins, kbd, q, s, samp,
5+
small, strike, strong, sub, sup, tt, var,
6+
b, u, i, center,
7+
dl, dt, dd, ol, ul, li,
8+
fieldset, form, label, legend,
9+
table, caption, tbody, tfoot, thead, tr, th, td,
10+
article, aside, canvas, details, embed,
11+
figure, figcaption, footer, header, hgroup,
12+
menu, nav, output, ruby, section, summary,
13+
time, mark, audio, video {
14+
margin: 0;
15+
padding: 0;
16+
border: 0;
17+
font-size: 100%;
18+
font: inherit;
19+
vertical-align: baseline;
20+
}
21+
/* HTML5 display-role reset for older browsers */
22+
article, aside, details, figcaption, figure,
23+
footer, header, hgroup, menu, nav, section {
24+
display: block;
25+
}
26+
body {
27+
line-height: 1;
28+
}
29+
ol, ul {
30+
list-style: none;
31+
}
32+
blockquote, q {
33+
quotes: none;
34+
}
35+
blockquote:before, blockquote:after,
36+
q:before, q:after {
37+
content: '';
38+
content: none;
39+
}
40+
table {
41+
border-collapse: collapse;
42+
border-spacing: 0;
43+
}

src/css/main.styl

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@import "base/reset.styl"
2+
@import 'modules/*'
3+
4+
body
5+
min-height 100vh
6+
position relative

src/html/index.twig

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
{% extends "modules/main.twig" %}
3+
4+
5+
{% block body %}
6+
{% include 'modules/header.twig' %}
7+
{% endblock %}

src/html/modules/footer.twig

Whitespace-only changes.

src/html/modules/header.twig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>Hello, world</h1>

src/html/modules/main.twig

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width">
6+
<link rel="shortcut icon" href="img/favicon.ico">
7+
<title>Архитектура программных систем</title>
8+
{% block stylesheets %}
9+
<link rel="stylesheet" href="css/main.css">
10+
{% endblock %}
11+
12+
{% block javascripts %}
13+
<script src="js/main.js"></script>
14+
{% endblock %}
15+
16+
</head>
17+
<body class="body">
18+
<div class="body__header">
19+
{% include '../modules/header.twig' %}
20+
</div>
21+
<div class="body__content">
22+
{% block body %}{% endblock %}
23+
</div>
24+
<div class="body__footer">
25+
{% include '../modules/footer.twig' %}
26+
</div>
27+
</body>
28+
</html>

src/js/base.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('file base.js');

src/js/mvc/controller.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('file controller.js');

src/js/mvc/model.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('file model.js');

src/js/mvc/view.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('file view.js');

0 commit comments

Comments
 (0)