You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to supply a function to the functions option, which would receive the loaderContext in the same way the data option currently can do. This would allow for example configuring functions that reference the path of the .scss source file, e.g. in order to parse the size of an image file on a relative path.
Actual Behavior / Situation
Currently I can supply functions as an option but have no way of accessing the path of the .scss file being loaded, because there is no access to the loaderContext. In other scenarios where node-sass is used, the sass source file path is generally known but here it is hidden away, which significantly limits what one can do with the functions option. Instead, this mechanism is supplied to the data option but this is actually a non-standard way to inject enhanced functionality to sass--it is meant rather only for the string content of the scss source--rather the standard way is really with the functions option.
Modification Proposal
These lines in normalizeOptions.js could simply be duplicated and modified to implement the functions option in the way I've described. I'd be happy to do a PR for this; however my further suggestion, which is to deprecate the use of the data option (due to its divergence from the standard usage pattern) and offer some kind of warning about it, I'm not sure how it could be implemented
The text was updated successfully, but these errors were encountered:
Expected Behavior / Situation
I'd like to be able to supply a function to the
functions
option, which would receive theloaderContext
in the same way thedata
option currently can do. This would allow for example configuring functions that reference the path of the.scss
source file, e.g. in order to parse the size of an image file on a relative path.Actual Behavior / Situation
Currently I can supply
functions
as an option but have no way of accessing the path of the.scss
file being loaded, because there is no access to theloaderContext
. In other scenarios where node-sass is used, the sass source file path is generally known but here it is hidden away, which significantly limits what one can do with thefunctions
option. Instead, this mechanism is supplied to thedata
option but this is actually a non-standard way to inject enhanced functionality to sass--it is meant rather only for the string content of the scss source--rather the standard way is really with thefunctions
option.Modification Proposal
These lines in
normalizeOptions.js
could simply be duplicated and modified to implement thefunctions
option in the way I've described. I'd be happy to do a PR for this; however my further suggestion, which is to deprecate the use of thedata
option (due to its divergence from the standard usage pattern) and offer some kind of warning about it, I'm not sure how it could be implementedThe text was updated successfully, but these errors were encountered: