Renan Gomes
Renan Gomes

Reputation: 829

Can I specify the output folder for assets?

I have a project with this structure:

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

For now, when I run parcel build src/index.pug, all the files are bundled and I've got this on the distribution folder:

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

When I was spected something like:

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

So, my question is: Can I specify the output path for my css, js and images using ParcelJS?

Upvotes: 15

Views: 13229

Answers (2)

Vladimir Mikulic
Vladimir Mikulic

Reputation: 171

Parcel doesn't support this feature out of the box, but I've developed a plugin for it. Check it out https://www.npmjs.com/package/parcel-plugin-custom-dist-structure

It is suitable for all types of web/node development projects, it will generate the dist structure you specify while also handle your imports.

Let me know what you think!

Upvotes: 7

tcurdt
tcurdt

Reputation: 15808

With version 1 it's not supported. This is supposed to be available in version 2 through user plugins. See https://github.com/parcel-bundler/parcel/issues/233

Upvotes: 5

Related Questions