@Zold09

Что делаю не так, проблема с json в gulp-file-include?

Здравствуйте! Начал изучение gulp и в сборке сталкнулся с проблемой: не понимаю почему не работает @@loop():
Код:
html:
<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./css/style.css">
    <title>Project-1</title>
</head>
<body>
    @@include("chank/header.html")
    <main class="main">
        <section class="main__news">
            @@loop("chank/news-item.html", "./data/news.json")
        </section>
    </main>
    @@include("chank/footer.html")
</body>
</html>


gulpfile.js :
const { src, dest } = require("gulp");
const fileinclude = require('gulp-file-include');

// обраткa html
const html = () => {
    return src("./src/**/*.*")
    .pipe(fileinclude({
        prefix: '@@',
        basepath: '@file',
      }))
        .pipe(dest("./public"))

}

exports.html = html


packeg.json
{
  "name": "build_glp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-file-include": "^2.3.0"
  }
}


Header и Footer компилирует, а вот посты через @@loop из json файла не выводит. пути указаны правильные, json файл простой - по типу [{},{},{}]
  • Вопрос задан
  • 132 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы