Skip to content

Commit

Permalink
Update documentation on source maps in README.md
Browse files Browse the repository at this point in the history
PostCSS only supports passing an existing source map
as { map: { prev: "..." } }, not directly as { map: "..." }.
See https://github.com/postcss/postcss/blob/8.0.3/lib/postcss.d.ts#L235.
  • Loading branch information
cr7pt0gr4ph7 authored and albb0920 committed Feb 7, 2024
1 parent 8cb3b04 commit cf0af28
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -202,7 +202,7 @@ Autoprefixer will generate a source map if you set `map` option to `true` in
`process` method.

You must set input and output CSS files paths (by `from` and `to` options)
to generate correct map.
to generate a correct map.

```ruby
result = AutoprefixerRails.process(css,
Expand All @@ -212,11 +212,12 @@ result = AutoprefixerRails.process(css,
```

Autoprefixer can also modify previous source map (for example, from Sass
compilation). Just set original source map content (as string) to `map` option:
compilation). Just set original source map content (as string) as `prev`
in the `map` option.

```ruby
result = AutoprefixerRails.process(css, {
map: File.read('main.sass.css.map'),
map: { prev: File.read('main.sass.css.map') },
from: 'main.sass.css',
to: 'main.min.css')

Expand Down

0 comments on commit cf0af28

Please sign in to comment.