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

Feature request: define include paths #41

Open
mafredri opened this issue May 8, 2017 · 22 comments
Open

Feature request: define include paths #41

mafredri opened this issue May 8, 2017 · 22 comments

Comments

@mafredri
Copy link

mafredri commented May 8, 2017

I would like to be able to configure include paths so that @import statements can reference the correct file.

Consider the following configuration:

"scss.includePaths": ["src", "global/lib"]

And a .scss-file:

@import 'variables';

The following paths (relative to project root) would be considered as valid imports (and the intellisense would also recognize the first match as the actual import):

src/variables.scss
src/_variables.scss
global/lib/variables.scss
global/lib/_variables.scss

Does this seem reasonable?

PS. Discovered this extension today, loving it so far. Keep up the good work!

@muuvmuuv
Copy link

muuvmuuv commented Apr 5, 2019

Would be really useful when developing with libraries like bootstrap where the pulled SCSS files are in node_modules folder. With includeFiles I could tell vscode-scss to take variables from bootstrap as well.

@octref octref modified the milestone: 0.8.0 Nov 12, 2019
@octref
Copy link
Collaborator

octref commented Nov 15, 2019

Can you clarify why this is needed? And how are you compilation this without sass errors?

When you import variables, it should only resolve to either variables.scss or _variables.scss.

@savilaf
Copy link

savilaf commented Dec 23, 2019

We need this for projects made with Angular. We define in the configuration file the folder where SASS has to resolve all the imports. Example (angular.json):

"stylePreprocessorOptions": {
  "includePaths": [
    "src/styles"
  ]
 }

On a component style:

@import 'utils/variables';

@ghaschel
Copy link

+1 for this feature. I'm unable to get autocomplete from functions imported from node_modules folder via @import ~module/sassfile

@jabuj
Copy link

jabuj commented Mar 18, 2020

+1
For my webpack project I have set webpack and sass-loader include path as so:

// ...
options: {
  includePaths: [path.resolve(__dirname, './src')],
  // ...
}
// ...

So that instead of
@use '../../../../styles/variables/colors';
I can write
@use 'styles/variables/colors';
That compiles just fine, so I would like some intellisense for that.

@SuneRadich
Copy link

I too would like to see better support for angular projects. In an angular project, you can define includePaths in angular.json. This tells the angular setup (webpack under the hood if I am not mistaken) where to look for scss files. This works fine when you compile the code - but VS Code is not able to show intellisense for imports.

@alastair-todd
Copy link

Webstorm handles this in a really simple, effective way - you right-click (a fabulous invention - hint) and there is an option to include the folder as "assets". From then on sccs @imports consider these paths and viola you can navigate to the files

@ekr3peeK
Copy link

ekr3peeK commented Jul 2, 2020

Plus one from me too for this feature.

@dbwodlf3
Copy link

I hope that vs code support this feature.

@kazamov
Copy link

kazamov commented Oct 19, 2020

I also need this feature for the Nrwl Nx workspace to share styles between libs

@mathiasrw
Copy link

4 years and this is still a feature request?

This is so important for scss development!

@JakeChampion
Copy link

@mathiasrw, feel free to add this feature if you think it is so important for scss development

@stasberkov
Copy link

Any update on this? I also would like to have this feature.

@JonasLuechau
Copy link

This one would be great for angular projects, without it you always have to use relative paths which is really annoying in big angular applications.

@muuvmuuv
Copy link

Is this still the case? VS Code has native SCSS support now, and you only need this extension for SASS, as I am aware.

@JonasLuechau
Copy link

This still doesn't work sadly. "@use 'colors';" doesn't work, "@use '../../colors';" does (assuming it would be a correct path). Both builds fine, but no autocomplete or being able to find the file is hard to work with.

Is this not in the scope of the extension?

@LeonFedotov
Copy link

please add support for this, this is a big pain point in my process !

@sutkovoy
Copy link

up

@stasberkov
Copy link

Why issue has label "Need More details"? What else details are needed?

@Nagell
Copy link

Nagell commented Sep 27, 2023

There's no need for any more details. A contributor is rather needed, as this project seems to be dead.

@fireMan-34
Copy link

Some Sass is more useful for myself. The extension id is SomewhatStationery.some-sass .

@stasberkov
Copy link

Some Sass is more useful for myself. The extension id is SomewhatStationery.some-sass .

Yep, I switched to it. I also installed dgeibi.alias-tool for non-relative path mapping.

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