XF 2.3 Replacing node icons via css

JoyFreak

Well-known member
In 2.2 you could simply do this with a css hack:
Code:
.node.node--id(node_id) .node-icon i:before {
    content: "\f019";
}

But now I see 2.3 uses svg. How does one replace the node icon using css with svg's?
 
You should use the mixin/LESS variables (in XF 2.2 too):

Less:
.node.node--id(node_id) .node-icon i
{
    &::before
    {
        .m-faContent(@fa-var-download, 1em);
    }

    svg
    {
        display: none;
    }
}
 
Last edited:
You should use the mixin/LESS variables (in XF 2.2 too):

Less:
.node.node--id(node_id) .node-icon i:before {
    .m-faContent(@fa-var-download);
}

This does indeed load a second icon. This CSS only approach seems to work:

Code:
.node .node-icon i
{
    &:before 
    {
        .m-faContent(@fa-var-upload);
        width: 100%;
    }
    svg
    {
        display: none;
    }
}

But it's essentially hiding the default SVG icon. Would you recommend a better approach (CSS only)?
 
You should use the mixin/LESS variables (in XF 2.2 too):

Less:
.node.node--id(node_id) .node-icon i:before {
    .m-faContent(@fa-var-download);
}
This worked for me. Why aren’t you using this instead?

Edit: from your post above it seems you are using that. I don’t know what I did. I think I must have hidden the svg as russ suggested above. I can’t really check right now as on mobile. Can confirm later.
 
This worked for me. Why aren’t you using this instead?

Edit: from your post above it seems you are using that. I don’t know what I did. I think I must have hidden the svg as russ suggested above. I can’t really check right now as on mobile. Can confirm later.

2.3 Beta 5 that code on a completely stock default style:

1713984402114.webp

No add-ons installed.
 
But it's essentially hiding the default SVG icon. Would you recommend a better approach (CSS only)?
Apologies, I forgot node icons were inlined for 2.3. For a CSS-only approach, I think hiding the SVG is about as good as it gets. I've edited my original post.
 
This is working for me on XF 2.3 Beta 5:

l
Less:
.node.node--idX {
    &.node--forum {

        .node-icon i {
            .m-faContent(@fa-var-dot-circle);
        }
        &.node--read .node-icon i {
            opacity: 0.4;
        }
    }
}


I don't see how this works on 2.3. I think you'll need to update the resource with hiding the SVG icon as well @BassMan
 
Why are we even doing this? 2.3 ships with 7870 Font Awesome SVGs.
\xenforo_2.3.0-Beta-6-Unstable_28DaysLater_2388B35DCE_upgrade\upload\styles\fa\regular alone has 1853 SVG files.

I simply want to be able to select one of these per node.
 
Back
Top Bottom