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

Source maps support #61

Merged
merged 1 commit into from
Jun 26, 2018
Merged

Source maps support #61

merged 1 commit into from
Jun 26, 2018

Conversation

frenzzy
Copy link
Contributor

@frenzzy frenzzy commented Jun 22, 2018

Fixes #53

const processOptions = Object.assign(
{ from: assetName, to: assetName },
this.options.cssProcessorOptions || {}
this.options.cssProcessorOptions
Copy link
Contributor Author

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 or undefined 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() };
Copy link
Contributor Author

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);
Copy link
Contributor Author

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 with prev: false.

@NMFR NMFR merged commit 15a41c8 into NMFR:master Jun 26, 2018
@NMFR
Copy link
Owner

NMFR commented Jun 26, 2018

Thx for the help

@frenzzy frenzzy deleted the patch-1 branch June 26, 2018 10:24
jasononeil added a commit to cultureamp/optimize-css-assets-webpack-plugin that referenced this pull request Jun 29, 2018
The fix was in this PR: NMFR#61

Fixes NMFR#53

For those of us stuck on Webpack 3
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.

None yet

2 participants