sass / migrator

Tool for migrating stylesheets to new Sass versions
MIT License
89 stars 11 forks source link

Globs don't work on Windows #204

Open GrujicMilos opened 3 years ago

GrujicMilos commented 3 years ago

I have project which use bootstrap. After install all necessary packages I wanted to migrate bootstrap scss files.

Example from my package.json:

"postinstall": "npm run migrate-bootstrap-sass", "migrate-bootstrap-sass": "sass-migrator division ../../../node_modules/bootstrap/scss/*.scss"

also I tried

"migrate-bootstrap-sass": "sass-migrator division ../../../node_modules/bootstrap/**/*.scss"

In both cases, migration does not work for me.

File by file migration works fine (you can see an example below).

"postinstall": "npm run migrate-bootstrap-bootstrap-grid && npm run migrate-bootstrap-variables ", "migrate-bootstrap-bootstrap-grid": "sass-migrator division ../../../node_modules/bootstrap/scss/bootstrap-grid.scss" "migrate-bootstrap-variables": "sass-migrator division ../../../node_modules/bootstrap/scss/_variables.scss"

I am using "sass-migrator": "^1.5.1", and my OS is Windows 10. Please any help.

jathak commented 3 years ago

This might be due to the some weird interaction between Node and the Windows command line.

Does the same issue occur when you run the migrator command directly?

GrujicMilos commented 3 years ago

I already tried migrator command directly. I have same issue when I run the migrator command directly.

jathak commented 3 years ago

Sorry for the delayed reply. Does wrapping the glob in single quotes (e.g. "sass-migrator division '../../../node_modules/bootstrap/scss/*.scss'") do anything? Windows doesn't support globs natively, so it's possible they're somehow being mangled before they make it to the migrator code.

nardo7 commented 2 years ago

I'm experiencing the same issue but for the module migrator:

I'm running sass-migrator --migrate-deps --load-path .\my\styles module .\path\to\the\app\src\**\*.scss and it doesn't work (returns Nothing to migrate!).
However running sass-migrator --migrate-deps --load-path .\my\styles module .\path\to\the\app\src\styles.scss or whatever single file path I give in, it does work.

Does the migrator actually work for multiple files paths or only for single file paths? I didn't find anything explicit about it in the documentation and every example is for one single file

Wrapping the path with single or double quotes doesn't change anything

Thanks for the help

GrujicMilos commented 2 years ago

I didn't find any solution for multiple files. We have problem with third party libraries. My team and me decided to wait third party libraries to migrate on Dart Sass 2.0.0.

jathak commented 2 years ago

Renaming this since the problem isn't that multiple files aren't supported; it's that there seems to be an issue with globs on Windows. I don't have a proper development environment set up on Windows to debug at the moment, but I'll try to take a look sometime soon.

As a workaround in the meantime, running in a Unix-style shell (e.g. cygwin or, even better, WSL) should let you use the shell's native glob resolution.

barkertron commented 2 years ago

I had great success in Windows when using PowerShell via Windows Terminal. Globs worked fine for me in that environment, e.g. sass-migrator division **/scss/**/*.scss - I didn't have to use WSL/Cygwin at all. Hope this helps!