dan503 / font-face-generator Goto Github PK
View Code? Open in Web Editor NEWAn @font-face generating Sass mixin to make adding custom fonts to websites much easier.
License: MIT License
An @font-face generating Sass mixin to make adding custom fonts to websites much easier.
License: MIT License
I'm trying to get your npm package to work, and it continues to throw an error derived from the mixin.scss file in the package. The specific error is:
F:\Web\Standard Assets>gulp fontface
F:\Web\Standard Assets\node_modules\font-face-generator\mixin.scss:2
$fonts: () !default;
^
SyntaxError: Unexpected token )
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (F:\Web\Standard Assets\gulpfile.js:4:13)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
Please note that the error also occurs if you attempt to declare the $font property as described in your instructions.
The details of my setup:
Clearly, your package requires a version of JS that allows $variable = ()
. I've seen hashmaps and similar structures expressed at $variable = []
and $variable = {}
, but never $variable = ()
.
If you need it, I can send the code that I did, but it clearly looks like the error is in your mixins.scss file.
When using a .otf font type, the format gets the wrong value.
Expected output
src: local("☺"), url(https://serneke-karlatornet.lndo.site:8080/cbb7485d8c63df71c318bc45a5268f05.otf) format("opentype");
Actual output
src: local("☺"), url(https://serneke-karlatornet.lndo.site:8080/cbb7485d8c63df71c318bc45a5268f05.otf) format("otf");
I'm using the following example:
@include font-face((
'Open Sans' : (
300 : 'open-sans-light'
)
));
and got this result:
@font-face {
font-family: Open Sans;
font-style: normal;
font-weight: 300;
src: local("☺"), url(../fonts/Open-Sans/open-sans-light.woff) format("woff");
}
As you can see, the font-family
is not wrapped with quotes.
Am I doing something wrong? I'm using the documentation example by the way.
EDIT:
Everything is fine, it was related to my CSS optimiser 😅
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.