Skip to content

Commit

Permalink
fix: respect content option for minification
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed May 31, 2020
1 parent a6ad67d commit 59b3c07
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 40 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"node-sass": "^4.14.1",
"postcss-custom-properties": "^9.1.1",
"prettier": "^2.0.5",
"rollup": "^2.11.2",
"rollup": "^2.12.0",
"rollup-plugin-dts": "^1.4.7",
"rollup-plugin-lit-css": "^2.0.3",
"rollup-plugin-node-externals": "^2.2.0",
Expand Down
66 changes: 33 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ export default (options: Options = {}): Plugin => {

cssNanoOpts.from = res.name;
cssNanoOpts.to = res.name;
cssNanoOpts.map = {
cssNanoOpts.map = sourceMap && {
inline: false,
annotation: false,
sourcesContent: true,
sourcesContent: sourceMap.content,
prev: res.map,
};

Expand Down
5 changes: 1 addition & 4 deletions src/loaders/postcss/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const loader: Loader<PostCSSLoaderOptions> = {
map: {
inline: false,
annotation: false,
sourcesContent: true,
sourcesContent: this.sourceMap ? this.sourceMap.content : true,
prev: mm(map).relative(path.dirname(this.id)).toObject(),
},
};
Expand Down Expand Up @@ -128,9 +128,6 @@ const loader: Loader<PostCSSLoaderOptions> = {
for (const asset of assets) this.assets.set(asset.to, asset.source);

map = mm((res.map?.toJSON() as unknown) as RawSourceMap)
.modify(m => {
if (this.sourceMap && !this.sourceMap.content) delete m.sourcesContent;
})
.resolve(path.dirname(postcssOpts.to))
.toString();

Expand Down

0 comments on commit 59b3c07

Please sign in to comment.