MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / fromFile

Method fromFile

packages/core/ui/styling/style-scope.ts:160–173  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

158 }
159
160 public static fromFile(url: string): CSSSource {
161 // .scss, .sass, etc. css files in vanilla app are usually compiled to .css so we will try to load a compiled file first.
162 const cssFileUrl = url.replace(/\..\w+$/, '.css');
163 if (cssFileUrl !== url) {
164 const cssFile = CSSSource.resolveCSSPathFromURL(cssFileUrl);
165 if (cssFile) {
166 return new CSSSource(undefined, url, cssFile, undefined);
167 }
168 }
169
170 const file = CSSSource.resolveCSSPathFromURL(url);
171
172 return new CSSSource(undefined, url, file, undefined);
173 }
174
175 public static fromFileImport(url: string, importSource: string): CSSSource {
176 const file = CSSSource.resolveCSSPathFromURL(url, importSource);

Callers 4

openFileFunction · 0.45
fromURIMethod · 0.45

Calls 2

replaceMethod · 0.80
resolveCSSPathFromURLMethod · 0.80

Tested by

no test coverage detected