-
Notifications
You must be signed in to change notification settings - Fork 58
Source maps support #61
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
Conversation
const processOptions = Object.assign( | ||
{ from: assetName, to: assetName }, | ||
this.options.cssProcessorOptions || {} | ||
this.options.cssProcessorOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From MDN:
Note that Object.assign() does not throw on
null
orundefined
source values.
@@ -30,33 +30,36 @@ class OptimizeCssAssetsWebpackPlugin extends LastCallWebpackPlugin { | |||
} | |||
|
|||
processCss(assetName, asset, assets) { | |||
const css = asset.source(); | |||
const css = asset.sourceAndMap ? asset.sourceAndMap() : { source: asset.source() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UglifyJS Webpack Plugin also uses sourceAndMap
function if exists
(map.mappings && map.mappings.length > 0) | ||
) | ||
) { | ||
processOptions.map = Object.assign({ prev: map }, processOptions.map); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From PostCSS docs:
prev
string, object, boolean or function: source map content from a previous processing step (for example, Sass compilation). PostCSS will try to read the previous source map automatically (based on comments within the source CSS), but you can use this option to identify it manually. If desired, you can omit the previous map withprev: false
.
Thx for the help |
Fixes #53