Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LESS don't work if has included unrecognized .less file. #1534

Closed
Pestov opened this issue Sep 9, 2013 · 13 comments
Closed

LESS don't work if has included unrecognized .less file. #1534

Pestov opened this issue Sep 9, 2013 · 13 comments

Comments

@Pestov
Copy link

Pestov commented Sep 9, 2013

We have one file: index.less. If we write in index.less @import ("included.css"); // unrecognized .css file that LESS work correctly. But if write @import("included.less"); // unrecognized .less file that LESS don't work and don't display error.

I test it on LESS 1.4.1 and 1.5.0

Thanks a lot.

@lukeapage
Copy link
Member

less 1.5.0 beta is no longer showing nice error messages for less files it cannot find?

@Pestov
Copy link
Author

Pestov commented Sep 10, 2013

Yes. And not only less 1.5.0, less 1.4.1 too

@lukeapage
Copy link
Member

ok.. well

  1. are you aware the brackets are wrong in your example? Its @import "included.less"; or @import url("included.less");
  2. on less2css.org the error appears for me in 1.4.1 http://less2css.org/

@Pestov
Copy link
Author

Pestov commented Sep 13, 2013

I am not use bracket in my project. I made a mistake just in issue

@lukeapage
Copy link
Member

.. and number 2, e.g. I cannot reproduce? browser or node? are you doing anything weird?

@ZoeBijl
Copy link

ZoeBijl commented Sep 18, 2013

I think that what he means is: if you try to include a css-file that doesn't exist, the compiler moves on and just ignores it. If you do the same with a less file, you get an error telling you the file can't be found.

@lukeapage
Copy link
Member

But a css file is kept verbatim and turned into an imort.. so depending on
the build process it might be added later? Could warn I suppose.

@Pestov
Copy link
Author

Pestov commented Sep 19, 2013

Ok. i recorded screencast http://youtu.be/x0ZssAHHjZI. Sorry for my English

@ZoeBijl
Copy link

ZoeBijl commented Sep 19, 2013

So, the problem is that when a .less-file is not found, LESS.js does not show an error?

@Pestov
Copy link
Author

Pestov commented Sep 19, 2013

Yes. I think error must be, bacause the strange thing is that everything works with unrecgnized .css

@lukeapage
Copy link
Member

can you reproduce it with your code on less2css.org ? because with simple examples it works, so it must be something in your less file or something wrong with your setup.

@Pestov
Copy link
Author

Pestov commented Oct 13, 2013

Sorry for bad feedback. Download this demo please http://yadi.sk/d/jhGUPRXsAsMZg, because i am not understand how i can reproduce it on less2css.org

@SomMeri
Copy link
Member

SomMeri commented Sep 5, 2014

I downloaded and tried the demo. Reported issue is that less.js returns an error if imported .less file is not found. Imported css is treated spit out to output as is.

I'm closing the issue, since this is working as it should. Imports of files with .css suffix are assumed to be css imports and less.js keeps them unchanged. Imports of files with .less suffix are assumed to be commands for compiler and files are supposed to be available.

Workaround: if you want an import of .less in the output, use css import directive:

@import (css) "unrecognized.less";

body {
    background-color: red;
}

If you want .less compiled if present and kept as is if not present, add +1 to the option import directive #2145 which covers that functionality.


Approximate content of of the demo:

If you do following:

@import "unrecognized.css"; // change to unrecognized.css and background will be red 
body { background-color: red; }

less.js spits out following:

@import "unrecognized.css"; 

body {
    background-color: red;
}

If you do following:

@import "unrecognized.less"; // change to unrecognized.css and background will be red 
body { background-color: red; }

less.js spits out error:

FileError: 'http://localhost:8888/unrecognized.less' wasn't found (404)
in index.less on line 1, column 1:

1@import "unrecognized.less"; // change to unrecognized.css and background will be red 
2

@SomMeri SomMeri closed this as completed Sep 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants