seitime-frappe/esbuild/sass_options.js
David Arnold 68d586e206
feat: import scss from node_modules in apps also (#22519)
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-10-30 19:01:47 +05:30

24 lines
657 B
JavaScript

let path = require("path");
let { get_app_path, app_list } = require("./utils");
let app_paths = app_list.map(get_app_path).map((app_path) => path.resolve(app_path, ".."));
let node_modules_path = app_paths.map((app_path) => path.resolve(app_path, "node_modules"));
module.exports = {
includePaths: [...node_modules_path, ...app_paths],
quietDeps: true,
importer: function (url) {
if (url.startsWith("~")) {
// strip ~ so that it can resolve from node_modules
url = url.slice(1);
}
if (url.endsWith(".css")) {
// strip .css from end of path
url = url.slice(0, -4);
}
// normal file, let it go
return {
file: url,
};
},
};