# PostCSS generates inline sourcemap by default

**URL:** https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066
**Category:** Uncategorized
**Created:** [February 17, 2019, 6:19am UTC](https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066 "2019-02-17T06:19:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [February 17, 2019, 6:19am UTC](https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066/1 "2019-02-17T06:19:24Z")

</div>

The [documentation](https://gohugo.io/hugo-pipes/postcss/) states:

> noMap [bool]  
> Default is `true` . Disable the default inline sourcemaps

But the inline sourcemap is still generated. If I set “noMap” to true, the inline sourcemap is still generated. However, if I set “no-map” to true then the inline sourcemap is not generated (as desired).

This generates an inline sourcemap (FAIL):

```auto
  {{- $optionsToCSS := (dict "outputStyle" "compressed") -}}
  {{- $optionsPostCSS := (dict "use" "autoprefixer") -}}
  {{- $css := resources.Get "css/main.scss" | resources.ToCSS $optionsToCSS | resources.PostCSS $optionsPostCSS -}}

```

This also generates an inline sourcemap (FAIL):

```auto
  {{- $optionsToCSS := (dict "outputStyle" "compressed") -}}
  {{- $optionsPostCSS := (dict "noMap" true "use" "autoprefixer") -}}
  {{- $css := resources.Get "css/main.scss" | resources.ToCSS $optionsToCSS | resources.PostCSS $optionsPostCSS -}}

```

This does not generate an inline source map (PASS):

```auto
  {{- $optionsToCSS := (dict "outputStyle" "compressed") -}}
  {{- $optionsPostCSS := (dict "no-map" true "use" "autoprefixer") -}}
  {{- $css := resources.Get "css/main.scss" | resources.ToCSS $optionsToCSS | resources.PostCSS $optionsPostCSS -}}

```

Environment:

- Ubuntu 18.04.2 LTS
- Hugo Static Site Generator v0.54.0/extended linux/amd64 BuildDate: 2019-02-01T13:31:26Z (installed from snap)

Per the [documentation](https://gohugo.io/hugo-pipes/postcss/), because I installed the Hugo snap package, I installed postcss-cli and autoprefixer in the Hugo site directory with:

```auto
$ npm install postcss-cli
$ npm install autoprefixer

```

Is the documentation incorrect? Is this a bug? Or am I doing something wrong?

---

<div class="post-metadata">

### Author: ![Leo\_Merkel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/leo_merkel/32/3321_2.png) [@Leo\_Merkel](https://discourse.gohugo.io/u/Leo_Merkel)
#### Post date: [February 17, 2019, 8:20am UTC](https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066/2 "2019-02-17T08:20:38Z")

</div>

I have this in my partial and it works. It’s conditional and enables SourceMap in ServerMode only.

```auto
{{ $cssOpts := cond ($inServerMode) (dict "targetPath" $cssTarget "enableSourceMap" true "includePaths" $sassIncludes) (dict "targetPath" $cssTarget "includePaths" $sassIncludes "outputStyle" "compressed") }}

```

Hope this helps

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [February 17, 2019, 5:31pm UTC](https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066/3 "2019-02-17T17:31:23Z")

</div>

Thanks. It looks like your $cssOpts is for ToCSS. My problem with noMap is related to PostCSS.

---

<div class="post-metadata">

### Author: ![Leo\_Merkel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/leo_merkel/32/3321_2.png) [@Leo\_Merkel](https://discourse.gohugo.io/u/Leo_Merkel)
#### Post date: [February 17, 2019, 7:25pm UTC](https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066/4 "2019-02-17T19:25:45Z")

</div>

I see. Can’t help though.

---

<div class="post-metadata">

### Author: ![budparr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/budparr/32/749_2.png) [@budparr](https://discourse.gohugo.io/u/budparr)
#### Post date: [February 17, 2019, 7:31pm UTC](https://discourse.gohugo.io/t/postcss-generates-inline-sourcemap-by-default/17066/5 "2019-02-17T19:31:18Z")

</div>

I’m not sure if this is helpful, but there’s a subtle distinction in the commands for when you are or are not using a config file, where the noMap command “seems” to be for when you’re using a config file.

You can see it more clearly in the CLI docs [https://github.com/postcss/postcss-cli](https://github.com/postcss/postcss-cli)
