How to make CSS filter work in VueJS after building?
up vote
0
down vote
favorite
When developing locally running a Node server, my SVG filter works. However, it doesn't when I build it and run it on a server.
The VueJS project is using Webpack.
I build the app like this:
npm run build
I have the filter declared like this:
filter: url(#white-glow);
When I build the application, the CSS is in a subfolder (/static/css) and I suspect as a result it can't find the filter anymore. When I check the HTML source in my inspector, the SVG filter is there.
When I apply said filter as a style attribute in the HTML it works.
<button style="filter:url(#white-glow);" data-v-32012fc8="">music</button>
Edit: I cannot use the above method since I want the filter to be active only in the :active state, which you can't do with inline style attribute.
How can I make the filter available in the external CSS file after building the app?
javascript css svg vue.js filter
add a comment |
up vote
0
down vote
favorite
When developing locally running a Node server, my SVG filter works. However, it doesn't when I build it and run it on a server.
The VueJS project is using Webpack.
I build the app like this:
npm run build
I have the filter declared like this:
filter: url(#white-glow);
When I build the application, the CSS is in a subfolder (/static/css) and I suspect as a result it can't find the filter anymore. When I check the HTML source in my inspector, the SVG filter is there.
When I apply said filter as a style attribute in the HTML it works.
<button style="filter:url(#white-glow);" data-v-32012fc8="">music</button>
Edit: I cannot use the above method since I want the filter to be active only in the :active state, which you can't do with inline style attribute.
How can I make the filter available in the external CSS file after building the app?
javascript css svg vue.js filter
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
When developing locally running a Node server, my SVG filter works. However, it doesn't when I build it and run it on a server.
The VueJS project is using Webpack.
I build the app like this:
npm run build
I have the filter declared like this:
filter: url(#white-glow);
When I build the application, the CSS is in a subfolder (/static/css) and I suspect as a result it can't find the filter anymore. When I check the HTML source in my inspector, the SVG filter is there.
When I apply said filter as a style attribute in the HTML it works.
<button style="filter:url(#white-glow);" data-v-32012fc8="">music</button>
Edit: I cannot use the above method since I want the filter to be active only in the :active state, which you can't do with inline style attribute.
How can I make the filter available in the external CSS file after building the app?
javascript css svg vue.js filter
When developing locally running a Node server, my SVG filter works. However, it doesn't when I build it and run it on a server.
The VueJS project is using Webpack.
I build the app like this:
npm run build
I have the filter declared like this:
filter: url(#white-glow);
When I build the application, the CSS is in a subfolder (/static/css) and I suspect as a result it can't find the filter anymore. When I check the HTML source in my inspector, the SVG filter is there.
When I apply said filter as a style attribute in the HTML it works.
<button style="filter:url(#white-glow);" data-v-32012fc8="">music</button>
Edit: I cannot use the above method since I want the filter to be active only in the :active state, which you can't do with inline style attribute.
How can I make the filter available in the external CSS file after building the app?
filter: url(#white-glow);
filter: url(#white-glow);
<button style="filter:url(#white-glow);" data-v-32012fc8="">music</button>
<button style="filter:url(#white-glow);" data-v-32012fc8="">music</button>
javascript css svg vue.js filter
javascript css svg vue.js filter
edited Nov 9 at 14:07
asked Nov 9 at 1:53
user1895910
11
11
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
The selector will not work like generic in an external css file.
If you're using the filter only in one file you could theoretically define the rule in the external css file like this:
filter: url(http://yourdomain.com/yourwebsite.html#white-glow);
Although, this wouldn't really make sense, so I would suggest to place the filter in an external svg file as well and then address it with the full url to the external SVG file in your CSS file
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
add a comment |
up vote
0
down vote
I have added a slash before my url. So now it looks like this in my Vue component and it parses fine when building. It looks like this now in both the component and the built CSS:
filter: url('/#white-glow');
I have successfully tested this in Firefox 47 and Chrome 70.
Could anybody explain why this works?
I tried to prefix it with./
which didn't work.. Havent thought of just the/
as that usually would be the root path of your domain.
– Edwin Krause
Nov 10 at 8:08
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The selector will not work like generic in an external css file.
If you're using the filter only in one file you could theoretically define the rule in the external css file like this:
filter: url(http://yourdomain.com/yourwebsite.html#white-glow);
Although, this wouldn't really make sense, so I would suggest to place the filter in an external svg file as well and then address it with the full url to the external SVG file in your CSS file
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
add a comment |
up vote
0
down vote
The selector will not work like generic in an external css file.
If you're using the filter only in one file you could theoretically define the rule in the external css file like this:
filter: url(http://yourdomain.com/yourwebsite.html#white-glow);
Although, this wouldn't really make sense, so I would suggest to place the filter in an external svg file as well and then address it with the full url to the external SVG file in your CSS file
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
add a comment |
up vote
0
down vote
up vote
0
down vote
The selector will not work like generic in an external css file.
If you're using the filter only in one file you could theoretically define the rule in the external css file like this:
filter: url(http://yourdomain.com/yourwebsite.html#white-glow);
Although, this wouldn't really make sense, so I would suggest to place the filter in an external svg file as well and then address it with the full url to the external SVG file in your CSS file
The selector will not work like generic in an external css file.
If you're using the filter only in one file you could theoretically define the rule in the external css file like this:
filter: url(http://yourdomain.com/yourwebsite.html#white-glow);
Although, this wouldn't really make sense, so I would suggest to place the filter in an external svg file as well and then address it with the full url to the external SVG file in your CSS file
answered Nov 9 at 10:30


Edwin Krause
1,051921
1,051921
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
add a comment |
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
Thanks! I can confirm this worked when done in my browser's inspector. I haven't tried building it with that path yet however.
– user1895910
Nov 9 at 16:40
add a comment |
up vote
0
down vote
I have added a slash before my url. So now it looks like this in my Vue component and it parses fine when building. It looks like this now in both the component and the built CSS:
filter: url('/#white-glow');
I have successfully tested this in Firefox 47 and Chrome 70.
Could anybody explain why this works?
I tried to prefix it with./
which didn't work.. Havent thought of just the/
as that usually would be the root path of your domain.
– Edwin Krause
Nov 10 at 8:08
add a comment |
up vote
0
down vote
I have added a slash before my url. So now it looks like this in my Vue component and it parses fine when building. It looks like this now in both the component and the built CSS:
filter: url('/#white-glow');
I have successfully tested this in Firefox 47 and Chrome 70.
Could anybody explain why this works?
I tried to prefix it with./
which didn't work.. Havent thought of just the/
as that usually would be the root path of your domain.
– Edwin Krause
Nov 10 at 8:08
add a comment |
up vote
0
down vote
up vote
0
down vote
I have added a slash before my url. So now it looks like this in my Vue component and it parses fine when building. It looks like this now in both the component and the built CSS:
filter: url('/#white-glow');
I have successfully tested this in Firefox 47 and Chrome 70.
Could anybody explain why this works?
I have added a slash before my url. So now it looks like this in my Vue component and it parses fine when building. It looks like this now in both the component and the built CSS:
filter: url('/#white-glow');
I have successfully tested this in Firefox 47 and Chrome 70.
Could anybody explain why this works?
edited Nov 9 at 16:51
answered Nov 9 at 16:44
user1895910
11
11
I tried to prefix it with./
which didn't work.. Havent thought of just the/
as that usually would be the root path of your domain.
– Edwin Krause
Nov 10 at 8:08
add a comment |
I tried to prefix it with./
which didn't work.. Havent thought of just the/
as that usually would be the root path of your domain.
– Edwin Krause
Nov 10 at 8:08
I tried to prefix it with
./
which didn't work.. Havent thought of just the /
as that usually would be the root path of your domain.– Edwin Krause
Nov 10 at 8:08
I tried to prefix it with
./
which didn't work.. Havent thought of just the /
as that usually would be the root path of your domain.– Edwin Krause
Nov 10 at 8:08
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53218753%2fhow-to-make-css-filter-work-in-vuejs-after-building%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown