symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 198 forks source link

Allow using package path for copyFiles() #1124

Open dkarlovi opened 2 years ago

dkarlovi commented 2 years ago

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]',
    });
weaverryan commented 2 years ago

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, 👍

dkarlovi commented 2 years ago

@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.
carsonbot commented 2 weeks ago

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?