NativeScript / nativescript-dev-sass

SASS CSS pre-processor for NativeScript projects
Apache License 2.0
44 stars 17 forks source link

If you import sass file into sass file an error will be thrown #58

Closed vhristov5555 closed 6 years ago

vhristov5555 commented 6 years ago
  1. import sas file in sass file (e.g."./1")
  2. Run "tns run ios" Actual: An error is thrown "Error: It's not clear which file to import for '@import "1"'. Candidates: 1.scss 1.css Please delete or rename all but one of these files. on line 5 of app/app.scss » @import './1';" Expected: To be able to import sass file in sass file
radeva commented 6 years ago

Hi @vhristov5555 ,

Which version of NativeScript are you using? Please, run tns info and paste the result here. Thanks!

vhristov5555 commented 6 years ago

Hi @radeva , I have just tested with {N} 3.4.0 and the result is the same.

radeva commented 6 years ago

Hi @vhristov5555 ,

This is caused by a limitation of the node-sass lib which is used under the hood of this plugin. There is an open issue long time ago discussing the topic and it looks like this is an expected behavior.

I would recommend in this case to use partial scss files which are basically named _somename.scss and imported as @import somename. No corresponding css files is created for partials so you won't experience the mentioned issue.

In case you have a reason not to use partials, other option is to use the file extension when importing the the file i.e. @import './1.scss'.

Let me know if this helps.

vhristov5555 commented 6 years ago

I was able to use it with "@import './1.scss'"

Thanks.