Skip to content
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

Merged
merged 7 commits into from
Apr 8, 2023

Conversation

niknov80
Copy link
Contributor

@niknov80 niknov80 commented Apr 4, 2023

  1. Добавлена обработка изображений
  2. Добавлен sourcemap для стилей и скриптов
  3. Сделано модульное подключение скриптов
  4. Исправлены пути скриптов и стилей для pixelGlass
  5. Добавлено удаление папки build перед сборкой

1. Добавлена обработка изображений
2. Добавлен sourcemap для стилей и скриптов
3. Сделано модульное подключение скриптов
4. Исправлены пути скриптов и стилей для pixelGlass
5. Добавлено удаление папки build перед сборкой
gulpfile.js Outdated
Comment on lines 18 to 20
import sharpOptimizeImages from "gulp-sharp-optimize-images";
import terser from 'gulp-terser';
import sourcemaps from 'gulp-sourcemaps';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

единообразие кавычек + давай в алфавитном порядке)

Copy link
Contributor Author

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}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{png,jpg,jpeg}

Copy link
Contributor Author

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({
Copy link
Contributor

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,
      },
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вынес в отдельную переменную

@@ -0,0 +1,3 @@
import {test} from "./script.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

одинарные кавычки в js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил

Comment on lines 22 to 23
<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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

папка pp в статике должна быть, не надо на уровень выше делать

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил пути здесь и в gulpfile.js

<script src="{{ url_for('static', filename='js/script.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/main.js') }}" type="module"></script>
Copy link
Contributor

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 можно оставить

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавил сборщик и сделал его в двух режимах dev и build

Copy link
Contributor

@ademaro ademaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока дорабатываем чутка, но в целом ок)

gulpfile.js Outdated
message: 'Error: <%= error.message %>'
})))
.pipe(sourcemaps.init())
.pipe(webpack({
Copy link
Contributor

@ademaro ademaro Apr 7, 2023

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...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sonarcloud
Copy link

sonarcloud bot commented Apr 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ademaro ademaro self-requested a review April 8, 2023 10:59
@ademaro ademaro merged commit 88d6d0e into makehtml:master Apr 8, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants