josh-hemphill / vite-plugin-favicon

Leverages on favicons to automatically generate your favicons for you. And if you want to also consolidate your PWA manifest, will generate that as well with linked icons.
MIT License
50 stars 12 forks source link

[BUG]: outputPath doesn't seem to affect anything #6

Open fiskhandlarn opened 3 years ago

fiskhandlarn commented 3 years ago

Prerequisites

Description

When I set outputPath and/or publicPath as described in README.md nothing seems to happen. The generated files are still written to the default public path. The only reference in the code that I can find is https://github.com/josh-hemphill/vite-plugin-favicon/blob/ecb662030ca5c752141801eb1edb303ac11270a9/src/index.ts#L39 which only looks like a definition, but does the package do anything? Any help is appreciated.

Steps to Reproduce

  1. Install this package and vite
  2. Configure like so:
    ViteFaviconsPlugin({
      logo: 'resources/static/images/favicons/goteborgsregionen.svg',
      publicPath: `public/themes/${process.env.WP_THEME}/assets/images/favicons`,
    }
  3. Run npm run build

Expected behavior:

I expect the files to be placed in assets/images/favicons/.

Actual behavior:

The files end up in assets/.

Reproduces how often:

100%

Versions

Platform: Docker
Version: 1.0.8
Editor(v): Emacs ¯_(ツ)_/¯
OS: Windows 10
fiskhandlarn commented 3 years ago

Oh, I just noticed this:

Public Path is delegated to Rollup/Vite (keeping for people migrating from Webpack)

That explains. But, can someone please help me explain how I can move files? https://www.npmjs.com/package/rollup-plugin-cpy doesn't seem to support moving files.

josh-hemphill commented 3 years ago

Yes, Vite doesn't give a lot of options for handling where files are output. Why do you need to move instead of copy your dist files? If you just need to clean up your dist folder after generating you could just tack an rm -R dist after your npm script, or for cross-platform and glob deletion install rimraf. e.g.

{
  "scripts":{
    "build":"vite build && rimraf 'dist/**.(png|ico)'"
  }
}

FYI, This package is currently broken. I've run into limitations of the Favicons package (it wasn't built with library authors in mind). My project at work that was going to use this got canceled, so I haven't had the time to finish rolling my own image generator library.

josh-hemphill commented 3 years ago

I'm going to keep this issue open as a documentation improvement. Once the package is working I'll want to potentially hide any no-op options and only specify the webpack config compatibility.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

roeeash commented 1 year ago

I encountered the same issue, is there a solution for it?