-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mini-runner): 修复 sass 变量失效的问题,close #4893
- Loading branch information
Showing
4 changed files
with
118 additions
and
31 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
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,24 @@ | ||
import { Bundler } from 'scss-bundle' | ||
|
||
/** | ||
* Return bundled sass content. | ||
* | ||
* @param {string} url Absolute file path. | ||
* @param {(string | undefined)} projectDirectory Absolute project location, where node_modules are located. Used for resolving tilde imports. | ||
* @returns Bundle result. | ||
*/ | ||
async function getBundleContent(url, projectDirectory?) { | ||
let bundler: any | ||
if (projectDirectory) { | ||
bundler = new Bundler(undefined, projectDirectory) | ||
} else { | ||
bundler = new Bundler() | ||
} | ||
if (!bundler) { | ||
throw new ReferenceError(`'bundler' is not defined.`) | ||
} | ||
const res = await bundler.Bundle(url) | ||
return res | ||
} | ||
|
||
export default getBundleContent |
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