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.

How to @import absolute path directly?

See original GitHub issue

webpack

    resolve: {
        alias: {
            $variables: path.resolve('./styles/variables.styl')
        }
    }

xx.styl

@import  '$variables '

//error

How to @import absolute path directly?

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
Panyacommented, Mar 6, 2017

You should define a variable using define in stylus-loader options:

stylus: {
  define: {
    $variables: path.resolve('./styles/variables.styl')
  }
}

And then inside a stylus file:

@import $variables

You can also use import option to auto-import these variables:

stylus: {
  import: [
    path.resolve('./styles/variables.styl')
  ]
}
1reaction
aseem2625commented, Jun 8, 2019

In case someone is looking for rollup. globals key is used to define in the plugin rollup-plugin-stylus-compiler

stylus({
   compiler: {
     globals: { $vars: path.resolve('src/styles/_vars.styl') }
   }
}),
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I import a module dynamically given the full path?
For Python 3.5+ use (docs): import importlib.util import sys spec = importlib.util.spec_from_file_location("module.name", "/path/to/file.py") foo ...
Read more >
Understand and Configure Absolute Import Paths in JavaScript
An absolute import path is a path that starts from a root, and you need to define a root first. In a typical...
Read more >
How to import a Python module given the full path?
This is the easiest way to import a Python module by adding the module path to the path variable. The path variable contains...
Read more >
Absolute vs Relative Imports in Python
An absolute import specifies the resource to be imported using its full path from the project's root folder. Syntax and Practical Examples. Let's...
Read more >
How to import a Python module given the full ... - Tutorialspoint
The easiest way to import a Python module, given the full path is to add the path to the path variable. The path...
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