generated from moevm/nsql-clean-tempate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
6,413 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/hello_world/node_modules | ||
/hello_world/_front/node_modules | ||
/hello_world/_front/_public | ||
/.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Примечание | ||
|
||
### Установка БД и зависимостей | ||
|
||
Для того чтобы можно было запустить данный проект локально, необходимо: | ||
1) Установить локальную базу данных MongoDB (требуется 2,5 ГБ свободного места): https://www.mongodb.com/try/download/community | ||
2) Убедиться, что установлен пакетный менеджер npm: `npm -v` | ||
3) Установить глобально gulp-cli `npm i --global gulp-cli` | ||
4) Запустить команду `npm i` в корне проекта и в папке `front` | ||
5) Дополнительно: для того, чтобы удобно просматривать содержимое базы данных MongoDB, существует приложение MongoDB Compass (находится не на самом верху, поэтому надо пролистать страницу скачивания до MongoDB Compass (GUI)): https://www.mongodb.com/try/download/compass | ||
|
||
Чтобы не качать базу данных, которая занимает много места, можно создать облачную базу MongoDB, однако сейчас есть проблемы с данным подходом, потому что работать база будет только за рубежом. | ||
|
||
### Запуск | ||
|
||
Для запуска сервера в режиме отладки используется команда `npm run start`, для обычного запуска - `npm run build`. По умолчанию порт: `4444`. | ||
|
||
Для запуска клиента, в папке `front` используется команда `gulp`. По умолчанию порт `3000`. | ||
|
||
Ссылка на видео: https://disk.yandex.ru/i/KQZQjkwABMsELQ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import gulp from "gulp" | ||
import browserSync from "browser-sync"; | ||
import gulpReplace from "gulp-replace"; | ||
|
||
import dartSass from 'sass'; | ||
import gulpSass from 'gulp-sass'; | ||
const sass = gulpSass(dartSass); | ||
|
||
const publicPath = "_public/"; | ||
const srcPath = "src/"; | ||
import sassGlob from 'gulp-sass-glob'; | ||
import newer from "gulp-newer"; | ||
import {deleteAsync} from "del"; | ||
|
||
const path = { | ||
build: { | ||
html: publicPath, | ||
css: publicPath + "css/", | ||
js: publicPath + "js/", | ||
img: publicPath + "img/", | ||
font: publicPath + "font/" | ||
}, | ||
src: { | ||
html: srcPath + "html/*.html", | ||
css: srcPath + "scss/style.scss", | ||
js: srcPath + "js/**/*.js", | ||
img: srcPath + "img/**/*.{jpg,jpeg,png,svg,gif,ico,webp}", | ||
font: srcPath + "font/**/*.{eot,woff,woff2,ttf,svg}" | ||
}, | ||
watch: { | ||
html: srcPath + "html/**/*.html", | ||
css: srcPath + "scss/**/*.scss", | ||
js: srcPath + "js/**/*.js", | ||
img: srcPath + "img/**/*.{jpg,jpeg,png,svg,gif,ico,webp}", | ||
font: srcPath + "font/**/*.{eot,woff,woff2,ttf,svg}" | ||
} | ||
} | ||
|
||
export const html = () => { | ||
return gulp.src(path.src.html) | ||
.pipe(gulpReplace(/src="\.\.\//g, "src=\"./")) | ||
.pipe(gulpReplace(/href=["']\.\.\/scss\/style\.scss/g, "href=\"css/style.css")) | ||
.pipe(gulpReplace(/src=["']\.\.\/([^"']+\.js)["']/g, 'src="$1"')) | ||
.pipe(gulp.dest(path.build.html)) | ||
.pipe(browserSync.stream()) | ||
} | ||
|
||
export const scss = () => { | ||
return gulp.src(path.src.css, {sourcemaps: true}) | ||
.pipe(sassGlob()) | ||
.pipe(sass()) | ||
.pipe(gulp.dest(path.build.css)) | ||
} | ||
|
||
|
||
export const js = () => { | ||
return gulp.src(path.src.js) | ||
.pipe(gulp.dest(path.build.js)); | ||
} | ||
|
||
export const clear = () => { | ||
return deleteAsync("./_public"); | ||
} | ||
|
||
export const img = () => { | ||
return gulp.src(path.src.img, {encoding: false}) | ||
.pipe(gulp.dest(path.build.img)) | ||
} | ||
|
||
export const font = () => { | ||
return gulp.src(path.src.font) | ||
.pipe(newer(path.build.font)) | ||
.pipe(gulp.dest(path.build.font)) | ||
} | ||
|
||
export const server = () => { | ||
browserSync.init({ | ||
server: { | ||
baseDir: "./_public" | ||
} | ||
}) | ||
} | ||
|
||
export const watch = () => { | ||
gulp.watch(path.watch.html, html).on("all", browserSync.reload); | ||
gulp.watch(path.watch.css, scss).on("all", browserSync.reload); | ||
gulp.watch(path.watch.js, js).on("all", browserSync.reload); | ||
gulp.watch(path.watch.img, img).on("all", browserSync.reload); | ||
gulp.watch(path.watch.font, font).on("all", browserSync.reload); | ||
} | ||
|
||
const dev = gulp.series( | ||
clear, | ||
gulp.parallel(html, scss, js, img, font), | ||
gulp.parallel(watch, server) | ||
) | ||
|
||
export default dev; |
Oops, something went wrong.