Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
norixx opened this issue Jun 13, 2023 · 0 comments
Open

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

norixx opened this issue Jun 13, 2023 · 0 comments

Comments

@norixx
Copy link

norixx commented Jun 13, 2023

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)

@forward "./scss/";

rollup.config.js

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant