-
Notifications
You must be signed in to change notification settings - Fork 71
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
Assets import #114
Comments
To make the above work I also had to add:
And Without the above I get:
(I was using a picture of a chook aka a chicken). |
It looks like the way Vue does it is to have the loader invoke the Vue compiler. They're able to get the AST as a result which makes it easier to handle things like this. I wonder if we should do something similar |
Using @GMartigny and @lloy0076 's fix allows setting of background images too.
|
Any update on this ? Currently, I'm trying to import assets via css ( Any alternates/workarounds for achieving the same? |
You can achieve this behavior with rollup image-loader.
|
For style tag image links there are two ways:
When using |
@dummdidumm; This should probably be labeled as a feature request. Webpack's default behavior requires you to explicitly import your assets. This can be seen in the "Loading Images" section of the asset management documentation. If this is a feature request, we probably need to flesh out exactly what needs to be handled. A good reference point might be the html-loader plugin. That plugin seeks out every loadable attribute in your markup and imports the asset for you. |
for ones who are looking quick copy/paste for webpack here it is: {
test: /\.(png|svg|jpg|gif)$/,
use: ['file-loader']
} put this in the |
Hi,
When importing assets (images for examples) inside HTML of svelte component, it's not processed by the loader and therefore neither by webpack.
example that don't work:
workaround:
You might be interested at the way
vue-loader
is doing it. I don't know if this is relevant to svelte tho.The text was updated successfully, but these errors were encountered: