mrcrowl / vscode-easy-less

Easy LESS extension for Visual Studio Code
MIT License
67 stars 23 forks source link

main support reg? #59

Closed Dailoge closed 4 years ago

Dailoge commented 4 years ago

I want to set many main file, but i don't kown how solve it

mrcrowl commented 4 years ago

This is supported. Information on how is covered in point 6 of the FAQ.

Dailoge commented 4 years ago

I don't understand; i have many main file, for example: pages/index/index.less pages/detail/index.less page/personal/index.less and more...

how should i write?

mrcrowl commented 4 years ago

First, to clarify, "main" file just means a file that @imports other less files.

If you always want to compile all of the above files every time any .less file is saved, then edit the JSON file for your user settings, and add:

{    
    "less.compile": {
        "main": ["pages/index/index.less", "pages/detail/index.less", "pages/personal/index.less"]
    }
}

If you only want to update certain main files when specific imported less files change, then you can add a comment to the top of the imported file:

e.g. imagine a file at: pages/index/anchors.less. It could contain the following main directive:

// main: ../../index.less

a { text-decoration: none }
mrcrowl commented 4 years ago

... Easy LESS doesn't automatically figure out which main files should be compiled. i.e. it doesn't detect @import statements in other files. You have to tell it where the other files are that import the "child" file.

Dailoge commented 4 years ago

ok, I know, thanks You're really great, man

Dailoge commented 4 years ago

i have another issue, how should i write 'out' and 'main' comment to the top of the imported file; i try

// out: true
// main: index.wxss
html {
  body {
    margin: 0px;
  }
}

but it not work, i need your help, thanks

mrcrowl commented 4 years ago

All directives must be on a single line at the top of the file, comma separated:

// main: index.wxss, out: true

html {
  body {
    margin: 0px;
  }
}
Dailoge commented 4 years ago

In this way, it still doesn't work