MCPcopy
hub / github.com/mrdoob/three.js / formatCSS

Function formatCSS

manual/examples/resources/editor.js:203–224  ·  view source on GitHub ↗
( css )

Source from the content-addressed store, hash-verified

201
202 // doesn't handle multi-line comments or comments with { or } in them
203 function formatCSS( css ) {
204
205 let indent = '';
206 return css.split( '\n' ).map( ( line ) => {
207
208 let currIndent = indent;
209 if ( line.includes( '{' ) ) {
210
211 indent = indent + ' ';
212
213 } else if ( line.includes( '}' ) ) {
214
215 indent = indent.substring( 0, indent.length - 2 );
216 currIndent = indent;
217
218 }
219
220 return `${currIndent}${line.trim()}`;
221
222 } ).join( '\n' );
223
224 }
225
226 async function getScript( url, scriptInfos ) {
227

Callers 1

parseHTMLFunction · 0.85

Calls 4

mapMethod · 0.80
includesMethod · 0.80
splitMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected