question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Global Variable not found on built in stylus-functions

See original GitHub issue

Hi,

I’m trying to switch from sass to stylus, but have a problem with built-in functions and global variables.

This is my style.styl:

// Variables / Helpers
@require "_components/_variables"

// Components
@require "_components/_base"

This is my _components/_variables.styl:

// Font Styles
main-font-size =    14px
main-font-size-large =    16px
main-line-height =  1.5
main-fonts =        "Helvetica Neue", Helvetica, Arial, sans-serif
alt-fonts =         "Helvetica Neue", Helvetica, Arial, sans-serif

// Layout
screen-sm = 480px 
screen-md = 768px
screen-lg = 960px
screen-xl = 1220px 

// Theme
primary-color =   #ff0
main-color =      #333

And this my _components/_base.styl:

[...]
a
  color primary-color

  &:hover,
  &:focus,
  &:active
    color: darken(primary-color, 10)

Until I come to the last part with the darken-function, everything wors just fine, but on darken it says:

[15:47:37] gulp-notify: [Error running Gulp] Error: /HTML5/node_modules/gulp-stylus/node_modules/stylus/lib/functions/index.styl:128:38
   124|
   125| // darken by the given amount
   126|
   127| darken(color, amount)
   128|   adjust(color, 'lightness', - amount)
---------------------------------------------^
   129|
   130| // lighten by the given amount
   131|

TypeError: expected rgba or hsla, but got ident:primary-color
    at "&:hover" (/HTML5/src/stylus/_components/_base.styl:35:22)
    at "a" (/HTML5/src/stylus/_components/_base.styl:32:124)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
quantuminformationcommented, Feb 4, 2016

my fav pre proc!

0reactions
Panyacommented, Feb 4, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Global Variables - Not Defined? - Stack Overflow
I'm running into an issue where a global variable isn't "remembered" after it's modified in 2 ...
Read more >
Global variables - IBM
A built-in global variable is part of the database management system, and is available to any SQL statement that runs on the database...
Read more >
A Future for R: Common Issues with Solutions
Issues with globals and packages. Missing globals (false negatives). If a global variable is used in a future expression that conditionally overrides this ......
Read more >
Global keyword in Python - GeeksforGeeks
It is used to create global variables in Python from a non-global scope, i.e. inside a function. Global keyword is used inside a...
Read more >
Python Variable Scope (With Examples) - Programiz
In this tutorial, we'll learn about Python Global variables, Local variables, and Nonlocal variables with the help of examples.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found