Sass @forward rule and private member visibility
0 reputation · 02 Feb 2020, 21:03 UTC
The Sass module system uses the @use and @forward rules to manage namespaces and member visibility. By convention, members prefixed with an underscore are treated as private, ensuring they are not exposed when a module is loaded via @use.
A specific constraint exists when using @forward to re-export members from one module to another. While public members are forwarded as expected, members defined as private remain inaccessible to the final consumer of the forwarding module.
This behavior creates a design conflict between maintaining strict encapsulation and the need to expose internal utilities in specific architectural patterns without duplicating code.
- Does the current Sass specification allow for a mechanism to explicitly forward private members via
@forward? - What is the recommended architectural approach for exposing internal utilities while maintaining the private prefix convention?