MCPcopy
hub / github.com/vitejs/vite / sass

Function sass

packages/vite/src/node/plugins/css.ts:1312–1339  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1310 },
1311
1312 get sass() {
1313 if (!sassResolve) {
1314 const resolver = createBackCompatIdResolver(config, {
1315 extensions: ['.scss', '.sass', '.css'],
1316 mainFields: ['sass', 'style'],
1317 conditions: ['sass', 'style', DEV_PROD_CONDITION],
1318 tryIndex: true,
1319 tryPrefix: '_',
1320 preferRelative: true,
1321 skipMainField: true,
1322 })
1323 sassResolve = async (...args) => {
1324 // the modern API calls `canonicalize` with resolved file URLs
1325 // for relative URLs before raw specifiers
1326 if (args[1].startsWith('file://')) {
1327 args[1] = fileURLToPath(args[1], {
1328 windows:
1329 // file:///foo cannot be converted to path with windows mode
1330 isWindows && !fileURLWithWindowsDriveRE.test(args[1])
1331 ? false
1332 : undefined,
1333 })
1334 }
1335 return resolver(...args)
1336 }
1337 }
1338 return sassResolve
1339 },
1340
1341 get less() {
1342 return (lessResolve ??= createBackCompatIdResolver(config, {

Callers

nothing calls this directly

Calls 2

resolverFunction · 0.85

Tested by

no test coverage detected