Roots Discourse

Possible to use Stylelint --fix?

Hello, I’m new to Sage having just left underscores. Loving it so far but it’s all new to me! I’m busy transferring in my sass files in and realising I’ve been not very neat with my scss! So I was manually changing some of the files which is a good learning curve but getting annoying now.

I see that stylelint should have an option to automatically fix things which would be a great time saver!
Just not exactly sure how to run it?! This is the command I found…

$ npx stylelint /styles.css --fix

Which I changed to:

$ npx stylelint /resources/assets/styles/main.scss --fix

And ran it from the theme folder and get this error:

Error: No files matching the pattern "/resources/assets/styles/main.scss" were found.
    at globby.then (/Users/naomispirit/Websites/arranecosavvy.org.uk/wp-content/themes/arran-eco-savvy/node_modules/stylelint/lib/standalone.js:212:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

But not working, should it even work?. Quite possibly doing something daft as I don’t quite understand it all yet! Thanks for any help.

Hi @meemal,

Try with:

yarn lint:styles --fix

Hope this will help you.

1 Like

Thank you! That appears to work a treat!

1 Like

Ok, cool.
Happy to hear that.

1 Like

works like charm, thank you my issue has been fixed.