I'm using some sass compilers to convert my scss files to css, but in one of the scss files I'm importing some css files from node_modules folder, along with other scss files from my src folder. Those css imports are included as url imports in the resultant css file instead of copying the contents of the file, and the scss imports are nicely copied over as contents. I can't rename these css files to scss as they are in node modules. Any workaround?
Asked
Active
Viewed 479 times
1
-
1Did you tried using ‘@import “path/to/filename”;’ without the .css extension? That will do the trick. – muecas Mar 09 '19 at 00:51
-
By not mentioning the extension, I get the error saying the file is either not found or unreadable. I then tried to add the extension .css, but it results in the import statement being carried over in the resultant file too instead of copying the file contents in the resultant file. Also the import statement now has `url(...)` format, which doesn't really work. The css is not really imported. – Rahul Dole Mar 11 '19 at 07:01
-
and did you double checked that the file is correctly linked relative to the scss file? Using grunt for example, it will be really simple to copy using a concatenation plugin. Which compiler are you using? – muecas Mar 11 '19 at 18:25
-
Yes, there is no path issue, as the same file is being imported in some other repo I'm working on without any issue. Its just that sass expects the extension to be .scss if you don't explicitly write the extension in import statement. But because in my case there is no .scss file in that node_modules folder, it says file not found. So if I mention .css in the import statement, then it can find it fine. Btw, I saw that this is a library issue as mentioned here https://github.com/sass/sass/issues/556. Its a long running issue, but I'm not sure whether its already fixed or not. – Rahul Dole Mar 12 '19 at 11:18