webpack-encore icon indicating copy to clipboard operation
webpack-encore copied to clipboard

Allow using package path for copyFiles()

Open dkarlovi opened this issue 3 years ago • 5 comments

The bundle will register a path like this

"@symfony/ux-turbo": "file:vendor/symfony/ux-turbo/Resources/assets",

It would be nice to be able to use this in the copyFiles(), like so

Encore.
    .copyFiles({
        from: '@symfony/ux-turbo/css',
        to: 'css/[path][name].[hash:8].[ext]',
    });

dkarlovi avatar May 31 '22 09:05 dkarlovi

Does this not work? I'm guessing it doesn't... but I thought that it actually might. This feature makes sense to me, but copyFiles() is tricky. So if someone can make a PR to get this going, then awesome, 👍

weaverryan avatar May 31 '22 14:05 weaverryan

@weaverryan since you assume it worked, I've re-tested it to make doubly sure, I did this:

{
    "dependencies": {
        "@sigwinhq/store-frontend": "file:vendor/sigwin/store-frontend-bundle/bundle/Resources/assets"
    }
}
$ ls vendor/sigwin/store-frontend-bundle/bundle/Resources/assets
controllers  css  icons  images  package.json
Encore
    .copyFiles({
        from: '@sigwinhq/store-frontend/icons',
        to: 'icons/[path][name].[hash:8].[ext]',
    })
$ npx encore prod
Running webpack ...

 WARNING  The "from" option of copyFiles() should be set to an existing directory but "@sigwinhq/store-frontend/icons" does not seem to exist. Nothing will be copied for this copyFiles() config object.

dkarlovi avatar Jun 01 '22 09:06 dkarlovi