Dan503/font-face-generator

Unexpected token: $fonts: () !default;

larry-tx opened this issue · 3 comments

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:

  • Server: Apache 2.4
  • Operating System: Windows 10 Pro
  • Gulp v. 4.0.2, CLI c. 2.2.0
  • Node 10.15.0

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.

Thanks for posting this.

It used to work ☹

If you dive into your local node_modules folder and replace all the $variable = () instances with either $variable = [] or $variable = {} does that fix the error?

I'm also interested to know what version of SCSS you are using. 🤔

I set up a small testing sort of environment for the project.

I wasn't able to replicate the issue that you are facing. I'm using gulp-sass v4.0.2 in my testing environment.

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.

It looks like I might be needing that code.

I'm also wondering if this is an issue with the version of Sass that you are running.

Closing due to inactivity and I am unable to replicate the issue.