This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acb08a4
commit 51a2a8c
Showing
14 changed files
with
10,752 additions
and
1,724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"extends": [ | ||
"skyscanner" | ||
"@skyscanner/eslint-config-skyscanner" | ||
], | ||
"settings": { | ||
"jest": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
lts/erbium | ||
lts/hydrogen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* backpack-node-sass | ||
* | ||
* Copyright 2018 Skyscanner Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const findParentDir = require('find-parent-dir'); | ||
|
||
function resolve(targetUrl, source) { | ||
const packageRoot = findParentDir.sync(source, 'node_modules'); | ||
|
||
if (!packageRoot) { | ||
return null; | ||
} | ||
|
||
const filePath = path.resolve(packageRoot, 'node_modules', targetUrl); | ||
const isPotentiallyDirectory = !path.extname(filePath); | ||
|
||
if (isPotentiallyDirectory) { | ||
if (fs.existsSync(`${filePath}.scss`)) { | ||
return `${filePath}.scss`; | ||
} | ||
|
||
if (fs.existsSync(filePath)) { | ||
return path.resolve(filePath, 'index'); | ||
} | ||
} | ||
|
||
if (fs.existsSync(path.dirname(filePath))) { | ||
return filePath; | ||
} | ||
|
||
return resolve(targetUrl, path.dirname(packageRoot)); | ||
} | ||
|
||
module.exports = function importer(url, prev) { | ||
return url[0] === '~' ? { file: resolve(url.substr(1), prev) } : null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.