{"id":366503,"date":"2024-05-21T03:01:07","date_gmt":"2024-05-21T03:01:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=366503"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=366503","title":{"rendered":"<span>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0443\u0442\u0438 \u043d\u0430 Svelte: \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 Svelte, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u044d\u0442\u043e \u043d\u0430 \u043c\u043e\u0435\u043c \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p><strong>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430: <\/strong><a href=\"https:\/\/github.com\/baterson\/pathfinding-visualizer\" rel=\"noopener noreferrer nofollow\"><strong>GitHub<\/strong><\/a><strong><br \/>\u041b\u0430\u0439\u0432 \u0434\u0435\u043c\u043e: <\/strong><a href=\"https:\/\/ivan-sem.com\/pathfinding_visualizer\" rel=\"noopener noreferrer nofollow\"><strong>ivan-sem.com<\/strong><\/a><\/p>\n<h2>1. \u041a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0441\u0435\u0442\u043a\u0438?<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f5\/533\/895\/8f553389513e00d9930a6029440b18ec.gif\" alt=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0434\u043e\u0432\" title=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0434\u043e\u0432\" width=\"1000\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f5\/533\/895\/8f553389513e00d9930a6029440b18ec.gif\"\/><\/p>\n<div><figcaption>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0434\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0434\u043e\u0432 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c keyframes CSS \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u043e\u0439 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441: <\/p>\n<pre><code class=\"css\">@keyframes touch {     0% {         transform: scale(0.7);     }     35% {         transform: scale(0.9);     }     100% {         transform: scale(1);     }   }    .inAnimation {       animation: touch 0.5s ease-in-out;   } <\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0434 \u0432 \u0441\u0435\u0442\u043a\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d <code>div<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c id. \u0414\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043d\u043e\u0434\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>writable<\/code> store \u0438\u0437 Svelte,  <code>animationQ<\/code>: <\/p>\n<pre><code class=\"javascript\">&lt;div id={node.key}     ... class:inAnimation={$animationQ.has(node.key)} \/><\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0435\u0449\u0435 \u0440\u0430\u0437.<\/p>\n<pre><code class=\"javascript\">const animateNode = (node) => {       queueAnimation(node.id);        node.addEventListener('animationend', () => removeFromAnimation(node.id), {           once: true       });        node.addEventListener('animationcancel', () => removeFromAnimationQ(node.id), {           once: true       });   }; <\/code><\/pre>\n<h2>2. \u0422\u0435\u043c\u043d\u0430\u044f \u0438 \u0441\u0432\u0435\u0442\u043b\u0430\u044f \u0442\u0435\u043c\u044b<\/h2>\n<p>\u0426\u0432\u0435\u0442\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CSS \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 <code>layout.svelte<\/code> \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0442\u0435\u043c\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u043e\u0440.<\/p>\n<pre><code class=\"javascript\">&lt;script lang=\"ts\"> import { theme } from '$lib\/stores\/theme'; &lt;\/script>  &lt;div class:light={$theme === 'light'}> &lt;slot \/> &lt;\/div>  &lt;style> div { --main-white: #f0e8f4; --bg-body: #160f1d;       --bg-not-visited: #3b2d52;         ...     }  .light { --bg-not-visited: var(--main-white); } &lt;\/style> <\/code><\/pre>\n<h2>3. \u041a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Google Analytics?<\/h2>\n<p>\u0414\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Google Analytics, \u043c\u0435\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 <code>Head<\/code> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0433\u0430 <code>&lt;svelte:head><\/code>.<\/p>\n<pre><code class=\"javascript\">&lt;script lang=\"ts\">     \/\/ API \u043a\u043b\u044e\u0447 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e env \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 import { env } from '$env\/dynamic\/public'; import { onMount } from 'svelte';  onMount(() => {         \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0433\u0443\u0433\u043b \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u043f\u043e \u0433\u0430\u0439\u0434\u0443 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u043e\u043a\u043e\u0432 window.dataLayer = window.dataLayer || [];  function gtag() { dataLayer.push(arguments); }  gtag('js', new Date()); gtag('config', env.PUBLIC_GTAG_KEY); }); &lt;\/script>  &lt;svelte:head> &lt;meta name=\"author\" content=\"Ivan Semochkin\" \/>     ...     {#if env.PUBLIC_GTAG_KEY}       &lt;script async src=\"https:\/\/www.googletagmanager.com\/gtag\/js?id={env.PUBLIC_GTAG_KEY}\">&lt;\/script>     {\/if} &lt;\/svelte:head> <\/code><\/pre>\n<h2>4. \u041f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u0431\u0438\u043b\u0434<\/h2>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 SvelteKit. \u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>npm run build<\/code>. \u0417\u0430\u043f\u0443\u0441\u043a \u0431\u0438\u043b\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/pm2.keymetrics.io\/\" rel=\"noopener noreferrer nofollow\">pm2<\/a>:<\/p>\n<p><code>pm2 start build\/index.js<\/code> <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Nginx:<\/p>\n<pre><code>upstream sveltekit-server {   server 127.0.0.1:3000;   keepalive 8; }  server {   listen 80;   server_name mydomain.com;    root \/home\/deploy\/frontend\/build\/client;    location \/ {     try_files $uri $uri\/ @sveltekit;   }    location @sveltekit {     proxy_set_header Host $http_host;     proxy_set_header X-Real-IP $remote_addr;     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;     proxy_set_header X-NginX-Proxy true;     proxy_set_header X-Forwarded-Proto $scheme;     proxy_set_header X-Sendfile-Type X-Accel-Redirect;      proxy_pass http:\/\/sveltekit-server;     proxy_redirect off;      # error_page 502 = @static;   }    location ^~ \/_app\/immutable\/ {     # gzip_static on;     expires max;     add_header Cache-Control public;     access_log off;     try_files $uri $uri\/ @sveltekit;   } }<\/code><\/pre>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0438 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0435\u0442 Svelte.  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/789402\/\"> https:\/\/habr.com\/ru\/articles\/789402\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 Svelte, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u044d\u0442\u043e \u043d\u0430 \u043c\u043e\u0435\u043c \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p><strong>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430: <\/strong><a href=\"https:\/\/github.com\/baterson\/pathfinding-visualizer\" rel=\"noopener noreferrer nofollow\"><strong>GitHub<\/strong><\/a><strong><br \/>\u041b\u0430\u0439\u0432 \u0434\u0435\u043c\u043e: <\/strong><a href=\"https:\/\/ivan-sem.com\/pathfinding_visualizer\" rel=\"noopener noreferrer nofollow\"><strong>ivan-sem.com<\/strong><\/a><\/p>\n<h2>1. \u041a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0441\u0435\u0442\u043a\u0438?<\/h2>\n<figure class=\"full-width\">\n<div><figcaption>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0434\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0434\u043e\u0432 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c keyframes CSS \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u043e\u0439 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441: <\/p>\n<pre><code class=\"css\">@keyframes touch {     0% {         transform: scale(0.7);     }     35% {         transform: scale(0.9);     }     100% {         transform: scale(1);     }   }    .inAnimation {       animation: touch 0.5s ease-in-out;   } <\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0434 \u0432 \u0441\u0435\u0442\u043a\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d <code>div<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c id. \u0414\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043d\u043e\u0434\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>writable<\/code> store \u0438\u0437 Svelte,  <code>animationQ<\/code>: <\/p>\n<pre><code class=\"javascript\">&lt;div id={node.key}     ... class:inAnimation={$animationQ.has(node.key)} \/><\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0435\u0449\u0435 \u0440\u0430\u0437.<\/p>\n<pre><code class=\"javascript\">const animateNode = (node) => {       queueAnimation(node.id);        node.addEventListener('animationend', () => removeFromAnimation(node.id), {           once: true       });        node.addEventListener('animationcancel', () => removeFromAnimationQ(node.id), {           once: true       });   }; <\/code><\/pre>\n<h2>2. \u0422\u0435\u043c\u043d\u0430\u044f \u0438 \u0441\u0432\u0435\u0442\u043b\u0430\u044f \u0442\u0435\u043c\u044b<\/h2>\n<p>\u0426\u0432\u0435\u0442\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CSS \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 <code>layout.svelte<\/code> \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0442\u0435\u043c\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u043e\u0440.<\/p>\n<pre><code class=\"javascript\">&lt;script lang=\"ts\"> import { theme } from '$lib\/stores\/theme'; &lt;\/script>  &lt;div class:light={$theme === 'light'}> &lt;slot \/> &lt;\/div>  &lt;style> div { --main-white: #f0e8f4; --bg-body: #160f1d;       --bg-not-visited: #3b2d52;         ...     }  .light { --bg-not-visited: var(--main-white); } &lt;\/style> <\/code><\/pre>\n<h2>3. \u041a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Google Analytics?<\/h2>\n<p>\u0414\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Google Analytics, \u043c\u0435\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 <code>Head<\/code> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0433\u0430 <code>&lt;svelte:head><\/code>.<\/p>\n<pre><code class=\"javascript\">&lt;script lang=\"ts\">     \/\/ API \u043a\u043b\u044e\u0447 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e env \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 import { env } from '$env\/dynamic\/public'; import { onMount } from 'svelte';  onMount(() => {         \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0433\u0443\u0433\u043b \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u043f\u043e \u0433\u0430\u0439\u0434\u0443 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u043e\u043a\u043e\u0432 window.dataLayer = window.dataLayer || [];  function gtag() { dataLayer.push(arguments); }  gtag('js', new Date()); gtag('config', env.PUBLIC_GTAG_KEY); }); &lt;\/script>  &lt;svelte:head> &lt;meta name=\"author\" content=\"Ivan Semochkin\" \/>     ...     {#if env.PUBLIC_GTAG_KEY}       &lt;script async src=\"https:\/\/www.googletagmanager.com\/gtag\/js?id={env.PUBLIC_GTAG_KEY}\">&lt;\/script>     {\/if} &lt;\/svelte:head> <\/code><\/pre>\n<h2>4. \u041f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u0431\u0438\u043b\u0434<\/h2>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 SvelteKit. \u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>npm run build<\/code>. \u0417\u0430\u043f\u0443\u0441\u043a \u0431\u0438\u043b\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/pm2.keymetrics.io\/\" rel=\"noopener noreferrer nofollow\">pm2<\/a>:<\/p>\n<p><code>pm2 start build\/index.js<\/code> <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Nginx:<\/p>\n<pre><code>upstream sveltekit-server {   server 127.0.0.1:3000;   keepalive 8; }  server {   listen 80;   server_name mydomain.com;    root \/home\/deploy\/frontend\/build\/client;    location \/ {     try_files $uri $uri\/ @sveltekit;   }    location @sveltekit {     proxy_set_header Host $http_host;     proxy_set_header X-Real-IP $remote_addr;     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;     proxy_set_header X-NginX-Proxy true;     proxy_set_header X-Forwarded-Proto $scheme;     proxy_set_header X-Sendfile-Type X-Accel-Redirect;      proxy_pass http:\/\/sveltekit-server;     proxy_redirect off;      # error_page 502 = @static;   }    location ^~ \/_app\/immutable\/ {     # gzip_static on;     expires max;     add_header Cache-Control public;     access_log off;     try_files $uri $uri\/ @sveltekit;   } }<\/code><\/pre>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0438 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0435\u0442 Svelte.  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/789402\/\"> https:\/\/habr.com\/ru\/articles\/789402\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-366503","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/366503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=366503"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/366503\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=366503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=366503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=366503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}