Can we Use Utils.js in "SCSS" I want to import fon...
# suitecommerce
h
Can we Use Utils.js in "SCSS" I want to import fonts in "SCSS" but have no idea how to use
src:url(Utils.getAbsoluteUrl(getExtensionAssetsPath('')
this function in SCSS
s
You shouldn't need that. If your font is stored in the extension's assets folder, then you just need to use
src: url(getExtensionAssetsPath('...'))
h
@Steve Goldberg I have tried this but it works fine for local setup , after deployment it returns "404 file not found error" !! It Also works fine when I hardcoded URL link of file uploaded in NETSUITE .. as I have fixed it for JS third-party library in js file using
url:Utils.getAbsoluteUrl(getExtensionAssetsPath('...')
, and now I am trying to upload Fonts but In SASS file Utils.getAbsoluteUrl not working for me as "UTILS" not defined in SASS
s
What URL is it requesting and what URL are you expecting?
h
With getExtensionAssetsPath it returns "`"http://scwsadmin111720hr.nstraining1.com/extensions/humza/ThirdPartyLibrary/1.0.0/fonts/"{{MyFileInFontsFolder}}""`" , but it actually works with
"<http://scwsadmin111720hr.nstraining1.com/SSP%20Applications/NetSuite%20Inc.%20-%20SCA%202020.1/Development/extensions/humza/ThirdPartyLibrary/1.0.0/fonts/>"{{MyFileInFontsFolder}}""
So how I can get this complete URL in SCSS file?
s
I've tested this and I can't replicate the problem you're experiencing
In my extension I have added a font to assets/fonts
Then in my SCSS I have added the following declaration:
Copy code
@font-face {
    font-family: 'Oracle Sans';
    font-style: normal;
    font-weight: 400;
    src: url(getExtensionAssetsPath("fonts/OracleSans-Rg.woff2"));
}
The font loads correctly
message has been deleted
Perhaps you can share your folder structure and Sass?