MCPcopy Index your code
hub / github.com/ampproject/amphtml / jsifyCssAsync

Function jsifyCssAsync

build-system/tasks/css/jsify-css.js:101–112  ·  view source on GitHub ↗

* 'Jsify' a CSS file - Adds vendor specific css prefixes to the css file, * compresses the file, removes the copyright comment, and adds the sourceURL * to the stylesheet * * @param {string} filename css file * @return {!Promise } that resolves with the css content after * processing

(filename)

Source from the content-addressed store, hash-verified

99 * processing
100 */
101async function jsifyCssAsync(filename) {
102 const {contents, hash: filehash} = await batchedRead(filename);
103 const imports = await getCssImports(filename);
104 const importHashes = await Promise.all(
105 imports.map(async (importedFile) => (await batchedRead(importedFile)).hash)
106 );
107 const hash = md5(filehash, ...importHashes, await getEnvironmentHash());
108 const result = await transformCss(contents, hash, filename);
109
110 result.warnings.forEach((warn) => log(red(warn)));
111 return result.css + '\n/*# sourceURL=/' + filename + '*/';
112}
113
114/**
115 * Computes the transitive closure of CSS files imported by the given file.

Callers 2

buildExtensionCssFunction · 0.85
writeCssEntryPointFunction · 0.85

Calls 8

batchedReadFunction · 0.85
getCssImportsFunction · 0.85
md5Function · 0.85
getEnvironmentHashFunction · 0.85
transformCssFunction · 0.85
redFunction · 0.85
logFunction · 0.50
forEachMethod · 0.45

Tested by

no test coverage detected