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.

Issue with absolute path for Less files

See original GitHub issue

Hi all,

I have issues importing a less file into another one from the same folder.

Files:

  • components – Home — default.less — page.less

default.less

@import '~antd/lib/style/themes/default.less';
@import (css) url('https://fonts.googleapis.com/css?family=Merriweather:400,700,900');

@font-family: "Merriweather";
@fw-bold: 900;

@site-heading-color: #0d1a26;
@site-text-color: #314659;

...

page.less

@import './default.less';

...

I receive the following error when I run yarn start

Error { [Error: './default.less' wasn't found. Tried - ./default.less,/Users/XXXX/ProjectYY/web/node_modules/antd/lib/style/default.less,/Users/XXXX/ProjectYY/web/src/default.less,default.less]
  type: 'File',
  filename:
   '/Users/XXXX/ProjectYY/web/node_modules/antd/lib/style/themes/default.less',
  index: undefined,
  line: null,
  callLine: NaN,
  callExtract: undefined,
  column: -1,
  extract: [ undefined, undefined, '@import "../color/colors";' ],
  message:
   '\'./default.less\' wasn\'t found. Tried - ./default.less,/Users/XXXX/ProjectYY/web/node_modules/antd/lib/style/default.less,/Users/XXXX/ProjectYY/web/src/default.less,default.less',
  stack: undefined }

I would appreciate your help.

Cheers!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
AnthonyJencommented, Sep 30, 2020

我从头看到尾都没看解决方法

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems resolving relative paths, while compiling less ...
Is there any reason why absolute paths and relative paths should act differently in less options? To me that seems not intuitive and...
Read more >
css - lesscss @import with absolute path - Stack Overflow
the import would be relative to the importing file, which is located in the /css folder. So why not import like `@import '../bootstrap/etc/etc', ......
Read more >
Using relative paths in LESS files [#3077427] | Drupal.org
I attached my LESS file using *.library.yml. My style uses a relative path to link fonts. After generation CSS by the module, this...
Read more >
How to Configure less-loader to Resolve Absolute Import Paths
Provided we have /styles under root, add the following resolve in your webpack config: const path = require('path') module.exports ...
Read more >
How to avoid long relative paths import in your angular app
So, you have imported the less directory with the hierarchy, now you can only import the filenames which exist inside the less directory,...
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