我可以指定资产的输出文件夹吗?

时间:2018-08-02 16:48:57

标签: parceljs

我有一个结构如下的项目:

src
 |- index.pug
 | - layout
 |     |- index.less
 | - scripts
 |     |- index.js

就目前而言,当我运行parcel build src/index.pug时,所有文件都捆绑了,我已经在分发​​文件夹中找到了它:

dist
  |- index.html
  |- index.12345.css
  |- index.12345.js

当我被发现像这样的时候:

dist
  |- index.html
  |- layout
  |    |- index.12345.css
  |- scripts
  |    |- index.12345.js

所以,我的问题是:我可以使用ParcelJS为CSS,JS和图像指定输出路径吗?

2 个答案:

答案 0 :(得分:4)

包裹不支持此功能,但我已经为此开发了一个插件。签出https://www.npmjs.com/package/parcel-plugin-custom-dist-structure

它适用于所有类型的Web /节点开发项目,它将生成您指定的dist结构,同时还处理导入。

让我知道您的想法!

答案 1 :(得分:1)

版本1不支持。可以通过用户插件在版本2中使用它。参见https://github.com/parcel-bundler/parcel/issues/233