在使用Pug和多个入口点设置包裹时出现问题

时间:2019-09-05 22:27:16

标签: parcel pug-loader

我正在尝试使用Pug和多个入口点设置包裹。我已经梳理过through the docs,但无法弄清楚自己在做什么错。现在,我有两个主要问题:

  1. 仅在构建时将CSS加载到about.html中,而不在index.html中加载CSS。
  2. 正在构建HTML文件,但我需要将它们构建到文件夹中。因此,about.pug应该构建为about/index.html。如何将哈巴狗文件构建到各自的文件夹中:page/index.html

项目结构:

 src
    ├── js
    │   └── index.js
    ├── pug
    │   ├── about.pug
    │   ├── index.pug
    │   └── layouts
    │       └── default.pug
    └── styles
        └── main.scss

about.pugindex.pug都在src/layouts/default.pug中使用默认布局。

SCSS文件导入到index.js中,如下所示:

import "../styles/main.scss";

但是由于某些原因,CSS在构建时仅导入about.html而不是index.html中。

这是我的package.json构建脚本:

"scripts": {
   "start": "parcel src/pug/*.pug",
   "build": "parcel build src/pug/*.pug"
}

如果您想看一下,这里是一个仓库:github repository

0 个答案:

没有答案