Closed sprlwrksAprilmintacpineda closed 6 years ago
I found my answer using --functions
tag.
example here:
require('dotenv').config();
const types = require('node-sass').types;
function cleanSlashes (str) {
return str
.replace(/^\//, '')
.replace(/\/$/, '');
}
module.exports = {
url: function (_path, done) {
const public_url = cleanSlashes(process.env.PUBLIC_URL) + '/';
if (public_url !== '/') {
done (types.String(`url('/${public_url}${cleanSlashes(_path.getValue())}')`));
} else {
done(types.String(`url('${public_url}${cleanSlashes(_path.getValue())}')`));
}
}
};
@sprlwrksAprilmintacpineda how do you use the url function in scss file?
Could it be possible for node-sass-chokidar to inject process.env files or maybe allow us to create a js file that would be run that would allow us to inject any variables that we like. inclusing the process.env?