postcss / postcss-cli

CLI for postcss
Other
836 stars 93 forks source link

Use existing sourcemaps for .sass #422

Closed kkmuffme closed 2 years ago

kkmuffme commented 2 years ago

I have a hello.sass file, which gets compiled to hello.css with a sourcemap.

When I run postcss to autoprefix, it will generate a new sourcemap, which will break the sourcemap of the sass from working. Instead I want it to update the existing sourcemap (like "-r" does to the .css file).

I found a solution here https://github.com/postcss/postcss/issues/222 but it's not for CLI and I don't know how I could do this with postcss-cli.

My command: postcss --config postcss.config.js --use autoprefixer --map -r hello.css

My settings: postcss.config.js

module.exports = ( ctx ) => ({
    plugins: {
        '/usr/lib/node_modules/postcss-sorting': {
            'order': [
                'custom-properties',
                'dollar-variables',
                'at-variables',
                'declarations',
                'at-rules',
                'rules'
            ],
            'properties-order': 'alphabetical',
            'unspecified-properties-position': 'bottom'
        }
    }
});
RyanZim commented 2 years ago

It should automatically pick up the sourcemap, if SASS left the correct sourcemap comment.

Also, you should define all your plugins in config, instead of using --use

RyanZim commented 2 years ago

Assuming this is resolved.