From 8151e00853e0b20b816494a1fa05b06008266e8b Mon Sep 17 00:00:00 2001
From: Alexander Repeta <alexander.repeta@gmail.com>
Date: Mon, 29 Jun 2020 22:59:37 +0300
Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?=
 =?UTF-8?q?=D0=B5=D1=82=20posthtml-include=20=D0=B8=20=D0=BF=D1=80=D0=B8?=
 =?UTF-8?q?=D0=BC=D0=B5=D1=80=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?=
 =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .posthtmlrc.js            |  7 +++++++
 package-lock.json         | 38 ++++++++++++++++++++++++++++++++++++++
 package.json              |  1 +
 src/index.html            |  3 +++
 src/partials/example.html | 32 ++++++++++++++++++++++++++++++++
 src/sass/_example.scss    | 17 +++++++++++++++++
 src/sass/main.scss        |  2 +-
 7 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 .posthtmlrc.js
 create mode 100644 src/partials/example.html
 create mode 100644 src/sass/_example.scss

diff --git a/.posthtmlrc.js b/.posthtmlrc.js
new file mode 100644
index 0000000..3dceabb
--- /dev/null
+++ b/.posthtmlrc.js
@@ -0,0 +1,7 @@
+module.exports = {
+  plugins: {
+    "posthtml-include": {
+      root: __dirname + "/src",
+    },
+  },
+};
diff --git a/package-lock.json b/package-lock.json
index 2ce38fb..5f66742 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3119,6 +3119,12 @@
       "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==",
       "dev": true
     },
+    "fclone": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz",
+      "integrity": "sha1-EOhdo4v+p/xZk0HClu4ddyZu5kA=",
+      "dev": true
+    },
     "file-uri-to-path": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@@ -5349,6 +5355,38 @@
         "posthtml-render": "^1.1.5"
       }
     },
+    "posthtml-expressions": {
+      "version": "1.4.3",
+      "resolved": "https://registry.npmjs.org/posthtml-expressions/-/posthtml-expressions-1.4.3.tgz",
+      "integrity": "sha512-Q7VWNThumerTQh96kSdSbkhJDzK7mV5ZU+fxAOmHpe8MRsXNFZit+YccK+KhqTB6mZ6GkCo19uj1pVWswX2maA==",
+      "dev": true,
+      "requires": {
+        "fclone": "^1.0.11"
+      }
+    },
+    "posthtml-include": {
+      "version": "1.4.3",
+      "resolved": "https://registry.npmjs.org/posthtml-include/-/posthtml-include-1.4.3.tgz",
+      "integrity": "sha512-2DOe1OIzhIOXUfHDGjGiH/VmdliT3rZ4Fcc/wyG9QxM+jhPbBWPQMJwisI6X4CrPrzU2YqXlrFS+JfwtB/9hww==",
+      "dev": true,
+      "requires": {
+        "posthtml": "^0.12.1",
+        "posthtml-expressions": "^1.3.2",
+        "posthtml-parser": "^0.4.2"
+      },
+      "dependencies": {
+        "posthtml": {
+          "version": "0.12.3",
+          "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.12.3.tgz",
+          "integrity": "sha512-Fbpi95+JJyR0tqU7pUy1zTSQFjAsluuwB9pJ1h0jtnGk7n/O2TBtP5nDl9rV0JVACjQ1Lm5wSp4ppChr8u3MhA==",
+          "dev": true,
+          "requires": {
+            "posthtml-parser": "^0.4.2",
+            "posthtml-render": "^1.2.2"
+          }
+        }
+      }
+    },
     "posthtml-parser": {
       "version": "0.4.2",
       "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.4.2.tgz",
diff --git a/package.json b/package.json
index b73e05c..7636abc 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
   "homepage": "https://github.com/goitacademy/parcel-project-template#readme",
   "devDependencies": {
     "parcel-bundler": "^1.12.4",
+    "posthtml-include": "^1.4.3",
     "sass": "^1.26.9"
   }
 }
diff --git a/src/index.html b/src/index.html
index dcd0ae8..96de979 100644
--- a/src/index.html
+++ b/src/index.html
@@ -6,6 +6,9 @@
     <title>Заголовок страницы</title>
   </head>
   <body>
+    <!-- Так добавляются фрагменты в главные HTML-файлы страниц -->
+    <include src="./partials/example.html"></include>
+
     <!-- Скрипт идёт последним в разметке -->
     <script src="index.js"></script>
   </body>
diff --git a/src/partials/example.html b/src/partials/example.html
new file mode 100644
index 0000000..9eae88f
--- /dev/null
+++ b/src/partials/example.html
@@ -0,0 +1,32 @@
+<article class="example">
+  <h1>HTML-фрагменты</h1>
+
+  <p>
+    Плагин
+    <a
+      href="https://github.com/posthtml/posthtml-include"
+      target="_blank"
+      rel="noopener noreferrer"
+    >
+      posthtml-include
+    </a>
+    позволяет добавлять в HTML-файлы страниц код из других HTML-файлов
+    (фрагментов). Фрагменты хранятся в папке
+    <code>src/partials</code>. Добавление происходит при компиляции файлов
+    страниц, например <code>index.html</code>.
+  </p>
+
+  <p>
+    Этот файл <code>example.html</code> &mdash; пример такого фрагмента, с
+    разметкой определённой части главной страницы. Это очень удобно при
+    командной разработке на студенческих проектах, когда в одном HTML-файле
+    пишет несколько человек сразу.
+  </p>
+
+  <p>
+    Синтаксис добавление фрагмента в главный файл:
+    <code>
+      &lt;include src="./partials/имя-файла.html"&gt;&lt;/include&gt;
+    </code>
+  </p>
+</article>
diff --git a/src/sass/_example.scss b/src/sass/_example.scss
new file mode 100644
index 0000000..406032d
--- /dev/null
+++ b/src/sass/_example.scss
@@ -0,0 +1,17 @@
+.example {
+  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+  line-height: 1.5;
+  color: #212121;
+  max-width: 960px;
+  padding: 15px;
+}
+
+.example code {
+  font-family: monospace;
+  font-size: 16px;
+  font-weight: 700;
+  background-color: lightgrey;
+  padding: 2px 6px;
+  border-radius: 2px;
+}
diff --git a/src/sass/main.scss b/src/sass/main.scss
index 8b13789..80b0fbe 100644
--- a/src/sass/main.scss
+++ b/src/sass/main.scss
@@ -1 +1 @@
-
+@import "./example";
-- 
GitLab