58

I would like to know how I can prevent Sass from writing .map files. I'm using Sass in a very basic setup:

sass --watch style.scss:style.css

what parameters do I have to add to avoid Sass to generate map files?

6 Answers 6

94

That depends on the implementation.

For node-sass and ruby-sass try this:

sass --sourcemap=none --watch style.scss:style.css

If you're using dart-sass the usage is --no-source-map:

sass --no-source-map --watch style.scss:style.css
8
  • thanks for your answer. Just for the clearance, can I somehow give this parameter once, that Sass remembers I never wanna have .map files?
    – supersize
    Jan 5, 2015 at 14:17
  • 1
    You can't. Just like you can't make it remember any of the other options you give to the sass command.
    – cimmanon
    Jan 5, 2015 at 14:22
  • @cimmanon I thought about something like a config file where I can set other default parameters too!
    – supersize
    Jan 5, 2015 at 14:23
  • @supersize, there is one. It's called environment.rb and it's hidden deeply in sass installation folder. Right now I'm trying to figure out how to modify this configuration, though I'm not very familiar with Ruby language. I'll update my answer when I'll success.
    – matewka
    Jan 5, 2015 at 14:31
  • @matewka thanks! Your answer is working btw, anyway it would be interesting to know how to disable it in general!
    – supersize
    Jan 5, 2015 at 14:33
16

it's works:

sass --watch --no-source-map input.scss output.css

with

1.8.0 compiled with dart2js 2.0.0-dev.66.0

3

I'm using sass version 1.13.2 compiled with dart2js 2.0.0 on Ubuntu and it's sass --no-source-map --watch [source].scss:[target].css

as --source-map enables source map and --no-source-map disables it.

2
  • I am using sass version 1.23.7 compiled with dart2js 2.6.1 on MacOs and it works like the way @ahmed mentioned. sass --no-source-map --watch [source].scss:[target].css
    – vsoni
    Jan 13, 2020 at 18:35
  • I am using sass version 1.26.2 compiled with dart2js 2.7.1 on windows. The above solution works for me. Thanks @ahmed kamal. May 30, 2020 at 15:10
1

Works:

sass --sourcemap=none style.scss style.css

Doesn't work, still generate .map file:

sass --update --sourcemap=none style.scss:style.css

So make sure you have no --update flag

2
  • thanks for adding this, I think this will help people!
    – supersize
    May 10, 2015 at 19:54
  • Use sass --update --force --sourcemap=none style.scss:style.css. --force flag will force compilation even if destination css is newer than scss
    – pista329
    Jan 15, 2016 at 13:15
1

It's now 2023, and the answers here led me to disabling the sourcemaps via PHPStorm 2020.1 and using its File Watchers facility (file/settings/tools/file watchers).

In the Arguments text box, I used the following, and the sourcemaps are now history.

--no-source-map $FileName$:../css/$FileNameWithoutExtension$.css

I hope this may help someone who, like me, was trawling the web for a couple of days for the solution.

0

As default, the sourcemap is enabled for Dart Sass and if you add --no-source-map it will disable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.