79680577

Date: 2025-06-26 13:31:05
Score: 2
Natty:
Report link

Thanks for sharing the issue — to resolve this issue you can try to follow these steps:

  1. Use Relative Paths with SCSS Interpolation
    Wrap your asset path in #{ } to prevent Angular's build system from processing the URL at compile time. This ensures the path remains unchanged in the final CSS:

    content: url(#{'vx-grid-assets/icons/indeterminate-box.svg'});
    

    This syntax bypasses Angular's path resolution during build while preserving the correct relative path for runtime.

  2. Verify Asset Configuration
    Ensure your angular.json correctly maps assets to the output directory:

    {
      "glob": "**/*",
      "input": "./common-libraries/vx-grid/vx-grid-resources/assets",
      "output": "vx-grid-assets"
    }
    

    This copies assets to dist/vx-grid-assets/ during build.

  3. Deployment to Salesforce
    Since Salesforce serves static resources from a unique base path (e.g., /resource//), relative paths like vx-grid-assets/... will resolve correctly at runtime. Avoid absolute paths (e.g., /vx-grid-assets/...), as they break in Salesforce's environment.

Why This Works

Example Implementation

// Component SCSS
.my-icon {
  &::before {
    content: url(#{'vx-grid-assets/icons/indeterminate-box.svg'});
    width: 16px;
    height: 16px;
  }
}

Troubleshooting

This approach balances Angular’s build requirements with Salesforce’s static resource constraints, ensuring icons load in both environments.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (2): Thanks for sharing
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Malva