8000 fix: sourcemap - inlined import file by garaboncias · Pull Request #52 · scniro/gulp-clean-css · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

fix: sourcemap - inlined import file #52

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = function gulpCleanCSS(options, callback) {
let map = JSON.parse(css.sourceMap);
map.file = path.relative(file.base, file.path);
map.sources = map.sources.map(function (src) {
return path.relative(file.base, file.path)
return path.relative(file.base, src)
});

applySourceMap(file, map);
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/sourcemaps-import/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import(partial.css);

div {
margin:10;
}
3 changes: 3 additions & 0 deletions test/fixtures/sourcemaps-import/styles/partial.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
div {
color:red;
}
20 changes: 20 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,26 @@ describe('gulp-clean-css: base functionality', () => {
});
});

it('should write sourcemaps, correct source path', done => {
let maps = {};
gulp.src(['test/fixtures/sourcemaps-import/styles/main.css'],{base:'test/fixtures/sourcemaps-import/styles'})
.pipe(sourcemaps.init())
.pipe(cleanCSS())
.pipe(sourcemaps.mapSources(function(sourcePath, file) {
maps[sourcePath] = true;
return sourcePath;
}))
.pipe(sourcemaps.write('./', {sourceRoot: '/'}))
.pipe(gulp.dest('test/fixtures/sourcemaps-import'))
.once('end', () => {
true.should.equal(maps['main.css']);
true.should.equal(maps['partial.css']);
done();
});


});

it('should write sourcemaps, worrectly map output', done => {

let i = 0;
Expand Down
0