-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having issues with copy
and relative path to to
#143
Comments
Hi
url([
{ url: 'copy', assetsPath: 'dist', useHash: true },
{
url: (asset) => {
return asset.url.replace('/dist', '') // result of previous step, can modify here
},
multi: true
}
])
; |
So to be clear option 1 would be: postcss({
to: './public/dist/',
extract: 'public/dist/app.css',
plugins: [
url({
url: 'copy',
useHash: true,
assetsPath: '.', // So this changes an `to` stays the same?
})
]
}) Otherwise option 2 looks good :) |
Okay so the above code created the image in the I tried: postcss({
to: './public/dist/',
extract: 'public/dist/app.css',
plugins: [
url({
url: 'copy',
useHash: true,
assetsPath: './dist', // So this changes an `to` stays the same?
})
]
}) Which put it in the right directory but the associate CSS is
As opposed to"
Because it does not include the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey so I have the following config (in
rollup
):And the following CSS:
Which is the closest I can get it to working, the image is in the right directory
public/dist
however the CSS path isbackground-image: url("dist/7d8c51c4.jpg");
This resolves to
http://localhost/dist/dist/7d8c51c4.jpg
as opposed tohttp://localhost/dist/7d8c51c4.jpg
.I am running a server in the
public/
directory and essentially need the path to be/dist/7d8c51c4.jpg
or alternatively./7d8c51c4.jpg
as the image is in the same root as the generated CSS file.I have tried every possible variation I can think of with the
to
andassetPath
arguments, but I either get the path right and the image in the wrong directory or the image in the right directory and the wrong path.Cheers.
The text was updated successfully, but these errors were encountered: