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

Add default to option #6

Merged
merged 2 commits into from
Apr 12, 2017
Merged

Add default to option #6

merged 2 commits into from
Apr 12, 2017

Conversation

lmk123
Copy link
Contributor

@lmk123 lmk123 commented Apr 12, 2017

When I use this plugin to generate source map, it removed the source map path in the css file.

Before:

#id{color:red}
/*# sourceMappingURL=my.css.map */

After I use this plugin:

#id{color:red}

My config looks like this:

var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')

module.exports = {
  devTool: 'source-map',
  plugins: [
    new OptimizeCSSPlugin({
      cssProcessorOptions: {
        map: { inline: false } // generate sourcemap use an external file
      }
    })
  ]
}

The PostCSS document says:

To ensure that you generate an accurate source map, you must indicate the input and output CSS file paths — using the options from and to, respectively.

So I add a default to option to keep source map path in the css file.

@NMFR NMFR merged commit 4b06a50 into NMFR:master Apr 12, 2017
@NMFR
Copy link
Owner

NMFR commented Apr 12, 2017

This is a bit intrusive, because it makes assumptions about the CSS processor's options.
But on the other side we really don't have a choice because the assetName is on our side.

In the weekend i will test it and make a new version on npm.

Thanks for the help.

@NMFR
Copy link
Owner

NMFR commented Apr 15, 2017

Tested and published on npm

@NMFR NMFR mentioned this pull request Apr 15, 2017
@lmk123
Copy link
Contributor Author

lmk123 commented Apr 16, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants