Skip to content

Commit

Permalink
normalize extracted path
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jan 16, 2018
1 parent 7594130 commit 14e5df0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ export default (options = {}) => {
filepath = postcssLoaderOptions.extract
} else {
const basename = path.basename(opts.file, path.extname(opts.file))
filepath = normalizePath(path.join(path.dirname(opts.file), basename + '.css'))
filepath = path.join(path.dirname(opts.file), basename + '.css')
}
}
filepath = normalizePath(filepath)
const concat = new Concat(true, filepath, '\n')
for (const res of extracted) {
const relative = normalizePath(res.id)
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ body {
/*# sourceMappingURL=extracted.css.map */"
`;

exports[`extract:path: css map 1`] = `"{\\"version\\":3,\\"sources\\":[\\"test/fixtures/dist/extract:path/foo.css\\",\\"test/fixtures/dist/extract:path/bar.css\\",\\"test/fixtures/dist/extract:path/test/fixtures/simple/style.styl\\",\\"test/fixtures/dist/extract:path/style.styl\\",\\"test/fixtures/dist/extract:path/style.sass\\",\\"test/fixtures/dist/extract:path/input\\",\\"test/fixtures/dist/extract:path/style.less\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;CACZ;;ACFD;EACE,WAAW;CACZ;;ACFD;EACE,YAAA;EACA,iBAAA;CCCD;AACD,0DAA0D;ACJ1D;EACE,WAAW;EACX,uBAAuB,EAAE;;ACC3B;EACE,eAAA;CCFD\\",\\"file\\":\\"/Users/egoist/dev/rollup-plugin-postcss/test/fixtures/dist/extract:path/this/is/extracted.css\\",\\"sourcesContent\\":[\\"body {\\\\n color: red;\\\\n}\\\\n\\",\\".bar {\\\\n color: red;\\\\n}\\\\n\\",null,null,\\"#sidebar {\\\\n width: 30%;\\\\n background-color: #faa; }\\\\n\\",null,null]}"`;
exports[`extract:path: css map 1`] = `"{\\"version\\":3,\\"sources\\":[\\"test/fixtures/dist/extract:path/foo.css\\",\\"test/fixtures/dist/extract:path/bar.css\\",\\"test/fixtures/dist/extract:path/test/fixtures/simple/style.styl\\",\\"test/fixtures/dist/extract:path/style.styl\\",\\"test/fixtures/dist/extract:path/style.sass\\",\\"test/fixtures/dist/extract:path/input\\",\\"test/fixtures/dist/extract:path/style.less\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;CACZ;;ACFD;EACE,WAAW;CACZ;;ACFD;EACE,YAAA;EACA,iBAAA;CCCD;AACD,0DAA0D;ACJ1D;EACE,WAAW;EACX,uBAAuB,EAAE;;ACC3B;EACE,eAAA;CCFD\\",\\"file\\":\\"test/fixtures/dist/extract:path/this/is/extracted.css\\",\\"sourcesContent\\":[\\"body {\\\\n color: red;\\\\n}\\\\n\\",\\".bar {\\\\n color: red;\\\\n}\\\\n\\",null,null,\\"#sidebar {\\\\n width: 30%;\\\\n background-color: #faa; }\\\\n\\",null,null]}"`;

exports[`extract:path: js code 1`] = `
"'use strict';
Expand Down

0 comments on commit 14e5df0

Please sign in to comment.