-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Добавлена обработка изображения + обновление конфигурации #4
Conversation
niknov80
commented
Apr 4, 2023
- Добавлена обработка изображений
- Добавлен sourcemap для стилей и скриптов
- Сделано модульное подключение скриптов
- Исправлены пути скриптов и стилей для pixelGlass
- Добавлено удаление папки build перед сборкой
1. Добавлена обработка изображений 2. Добавлен sourcemap для стилей и скриптов 3. Сделано модульное подключение скриптов 4. Исправлены пути скриптов и стилей для pixelGlass 5. Добавлено удаление папки build перед сборкой
gulpfile.js
Outdated
import sharpOptimizeImages from "gulp-sharp-optimize-images"; | ||
import terser from 'gulp-terser'; | ||
import sourcemaps from 'gulp-sourcemaps'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
единообразие кавычек + давай в алфавитном порядке)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделал
gulpfile.js
Outdated
@@ -150,8 +153,43 @@ export const sprite = () => src(`${path.img.icons}**/*.svg`) | |||
.pipe(rename('sprite.svg')) | |||
.pipe(dest(path.img.save)) | |||
|
|||
const images = () => src(`${path.images.root}/**/*.{png,jpg}`) | |||
.pipe(dest(path.images.save)) | |||
export const img = () => src(`${path.img.root}/**/*.{png,jpg}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{png,jpg,jpeg}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавил
gulpfile.js
Outdated
.pipe(dest(path.images.save)) | ||
export const img = () => src(`${path.img.root}/**/*.{png,jpg}`) | ||
.pipe(plumber()) | ||
.pipe(sharpOptimizeImages({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давай отдельно вынесем
{
webp: {
quality: 80,
lossless: false,
},
png_to_png: {
quality: 80,
lossless: false,
},
jpg_to_jpg: {
quality: 80,
mozjpeg: true,
},
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вынес в отдельную переменную
src/static/js/main.js
Outdated
@@ -0,0 +1,3 @@ | |||
import {test} from "./script.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
одинарные кавычки в js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
src/templates/base.j2
Outdated
<link href="{{ url_for('static', filename='pp/styles.css') }}" rel="stylesheet"> | ||
<script src="{{ url_for('static', filename='pp/script.js') }}"></script> | ||
<link href="{{ url_for('static', filename='../pp/styles.css') }}" rel="stylesheet"> | ||
<script src="{{ url_for('static', filename='../pp/script.js') }}"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
папка pp в статике должна быть, не надо на уровень выше делать
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил пути здесь и в gulpfile.js
src/templates/base.j2
Outdated
<script src="{{ url_for('static', filename='js/script.min.js') }}"></script> | ||
<script src="{{ url_for('static', filename='js/main.js') }}" type="module"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я бы оставил script.min.js и прикрутил бандлер (сборщик всех модулей в один файл)
для разработки — type=module можно оставить
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавил сборщик и сделал его в двух режимах dev и build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пока дорабатываем чутка, но в целом ок)
# Conflicts: # gulpfile.js # package.json
gulpfile.js
Outdated
message: 'Error: <%= error.message %>' | ||
}))) | ||
.pipe(sourcemaps.init()) | ||
.pipe(webpack({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я бы не тянул тяжелый вабпак, тем более он жирный бандл делает, можем обсудить что лучше: parcel, rollup, fusebox, esbuild, vite...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |