Less import path -- where does it find libraries? - less

I'm looking at this code from Atom:
#import "ui-variables";
Which is being resolved to this ui-variables.less file.
My question is: by which rule did it do so? Where's the config that tells it to look in this static/variables directory for this file?

Related

cannot find .h file even after installing ADALiOS pod

I installed ADALiOS using pods, and I changed the library search path as per the documentation but I still get file not found when I try the following include
#import <ADALiOS/ADAuthenticationSettings.h>
my search path are as follows
$(SRCROOT)/Pods/ADALiOS/**
I can see the file under the Pods folder/ADALiOS as well but I just cannot link it for some reason
Why is not being picked up?
EDIT --
if I drag and drop the header onto the file it gives me this include path and that works?
#import </Users/mdouhan/Documents/dev/NWMobileTill/Pods/ADALiOS/ADALiOS/ADALiOS/ADAL.h>
I don't understand why its repeated so many times?

Relative path of node_modules for LESS #import

Say I have the following structure
/node_modules
/src
/components
/component1
/style
/style.less
Now I want to import some LESS file from node_modules/some-module/style.less; I'd have to do something like #import '../../../../node_modules/some-module/style.less
Is there no short hand notation so that the path is relative to project folder? Something like #import ~/node_modules/some-module/style.less?
You can achieve this by installing less-loader and add it into webpack.
How to do it:
https://www.npmjs.com/package/less-loader#webpack-resolver
Example:
#import "~font-awesome/css/font-awesome.min.css";

WebStorm: How to trigger a Less compilation only on the main.less file while watching multiple files?

I have a .less files directory with:
main.less (just import the dependencies)
dep1.less
dep2.less
etc.
I want that modifying a dependency triggers the compilation of the main.less file ONLY.
For now here is my configuration in WebStorm Less watcher. What scope and arguments I need?
Thx to #LazyOne comments I manage to find the right settings.
set the watch scope to the entire folder
put ../$FileNameWithoutExtension$.css at the end of less command arguments
uncheck Create output file from stdout causing empty output file (don't know why)
check Track only root files. Which is not very explicit in my case. Indeed it does not really watch the root file but all the #import dependencies and ONLY COMPILE THE ROOT FILE.
If you prefix your partial files with an underscore
(_dep1.less,_dep2.less)
they wont be compiled. And that doesn't even effect how you call them: #import _dep1.less will import _dep1.less.

Import files in objective-c using wildcard

Is it possible to import a glob of header files based on wildcard directives? I want to semantically do the following:
#import "*-(Extensions).h"
to import all files in my local directory that end with -(Extensions).h. How might I go about this? Thanks in advance for any help!
Nope.
If you don't want to write a dozen import directives in multiple source files, you could write one header that imports all of your -(Extensions).h files, then import that into your source.
You could generate said header automatically from a directory listing with a bit of shell scripting, then make that shell script a build phase in your Xcode project.

How to include a static library and have its #import paths still be valid?

Say I have a static library that was created with the following file structure:
Folder1
File1.h
Folder2
File2.h
Now inside of File1.h, it refers to File2.h without a path (e.g. #import File2.h). The library builds successfully. (It doesn't require the full path (i.e. #import Folder2/File2.h) because both files are part of the same project.)
Now when I include this library in another project, that #import File2.h statement no longer compiles, and I have to change it to #import Folder2/File2.h (or something similar). This means that I have to modify the original library, which is not good.
The specific error message I get is:
File2.h: No such file or directory
There doesn't seem to be a way to let it know that both files should be a part of this new project, since the only two files I see after I included the library are MyLib.xcodeproj and lixMyLib.a.
The way I included the static library in my new project is by doing the following:
Drag MyLib.xcodeproj into my new project.
Add the libMyLib.a file to my new project's target.
Add to the Header Search Paths a relative path to the home directory of my library (the folder that contains Folder1 and Folder2).
Is there any way I can have it automatically know where to find these files just as it was able to do in the library itself? I realize that I can probably add the paths Folder1 and Folder2 to the Header Search Paths of my new project, but I'm looking for a better way, since these two folders are just an example, and it could just as easily be 50 folders I would need to include. I'm looking for a solution which doesn't require me to type the paths to all 50 of those folders, if possible.
Try checking the "Recursive" checkbox next to the path to the parent folder of all those headers.