Is there a way to configure filename outputs? I only see options for entry point
You can use the --out-file
flag (short version is -o
)
For example:
parcel entry.html -o bundle.html
Does anybody know why the --out-file
flag doesn鈥檛 come up when the help command is ran?
cc\ @devongovett
@thedewpoint
Is there a way to configure filename outputs? I only see options for entry point
Currently, you can only rename the entry point as you've mentioned using -o
.
@davidnagli - shows up for me parcel serve --help
, parcel build --help
, etc:
@brandon93s Whoops had an older version of Parcel running on this machine (I guess Parcel didn鈥檛 have the option in v1.5.1). Works perfectly after updating.
@thedewpoint Ya you can only change the entry point output filename, it probably won鈥檛 be feasible for a zero-config bundler to give users complete control over all the output filenames from the CLI.
You should, however, be able to get complete programmatic control over file names pretty easily if you create your own Packager.
Btw depending on the reason why you鈥檙e asking about controlling the filenames, this RFC might be relevant to you: #872
On a somewhat related note, the --out-file
doesn't seem to honor the extension I use:
parcel watch ./client/src/index.htm --out-dir ./client/dist --out-file index.htm
... produces a file called index.html
even though my out-file (and my entry-point) uses .htm
file extensions.
out-file is just the filename not containing the extension.
Is there any particular use for using htm over html as extension?
Not sure if there should be a way to rename all files instead of just the entrypoint?
If not than I guess we can close this issue
@DeMoorJasper just habit. Been using .htm
for years. Good to know that the out-file option is only for the filename base. Thanks!
This doesn't work when using Parcel 2?
This doesn't work when using Parcel 2?
+1 got error: unknown option
-o' `
This doesn't work when using Parcel 2?
This doesn't work when using Parcel 2?
+1 got
error: unknown option
-o' `
Parcel 2 uses the main
field in package.json
as your output file.
You can use the
--out-file
flag (short version is-o
)For example:
parcel entry.html -o bundle.html
That outputs the .html not the JS file as the OP has requested.
Most helpful comment
On a somewhat related note, the
--out-file
doesn't seem to honor the extension I use:... produces a file called
index.html
even though my out-file (and my entry-point) uses.htm
file extensions.