egoist / egoist/rollup-plugin-postcss

Sourcemap file points to the compiled scss when its setting is `true`

Open
#449 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
689
Forks
210
PR merge metrics
No merged PRs in 30d

Description

I am using the plugin to deal with multiple .scss files(partials)

The problem is that depending on whether the `sourceMap` setting is `'inline'` or `true`, the result of the output file will be different.

My folder structure is simple like this:

- 📁src
- 📁 partials
- _part1.scss
- _part2.scss
- _index.scss (File to forwards part1 and part2)
- style.scss

If the setting is `'inline'`, it's no problem that the inlined sourcemap points to the right partial file.
But if I set it to `true`, the sourcemap file just points to style.scss, which for some reason appears to be compiled.

style.scss(just forwards partial files nothing else)
```scss
@forward "./scss/";
```

rollup.config.js
```javascript
plugins: [
postcss({
extract: true,
sourceMap: true,
minimize: {
preset: [
'default',
{ discardComments: false }
]
},
plugins: [
autoprefixer(),
]
})
]
```

Output
```
{"version":3,"sources":["style.scss"],"names":[],"mappings":"....","file":"bundle.css","sourcesContent":[".local {\n background-color: rgb(255, 230, 32);\n}\n\n::selection {\n color: white;\n background: blue;\n}\n\nh1 {\n color: #333;\n}\n\n.test {\n background-color: rgb(255, 230, 32);\n font-size: calc(14px + 2vw);\n color: green;\n border-bottom: 2px solid greenyellow;\n}"]}
```
I also do not need sourcesContent which makes my compiled css almost twice as big.

I'm not a Postcss expert, so I may be misguided.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.