MCPcopy Create free account
hub / github.com/ampproject/amphtml / writeCss

Function writeCss

build-system/tasks/css/index.js:98–107  ·  view source on GitHub ↗

* Writes CSS to build folder * * @param {string} css * @param {string} jsFilename * @param {string} cssFilename * @param {boolean} append append CSS to existing file * @return {Promise }

(css, jsFilename, cssFilename, append)

Source from the content-addressed store, hash-verified

96 * @return {Promise<void>}
97 */
98async function writeCss(css, jsFilename, cssFilename, append) {
99 await fs.ensureDir('build/css');
100 const jsContent = 'export const cssText = ' + JSON.stringify(css);
101 await fs.writeFile(`build/${jsFilename}`, jsContent);
102 if (append) {
103 await fs.appendFile(`build/css/${cssFilename}`, css);
104 } else {
105 await fs.writeFile(`build/css/${cssFilename}`, css);
106 }
107}
108
109/**
110 * @param {string} path

Callers 1

writeCssEntryPointFunction · 0.85

Calls 1

stringifyMethod · 0.80

Tested by

no test coverage detected