Last active
August 29, 2015 14:22
-
-
Save hail2u/c165618ee5b05f8d2de0 to your computer and use it in GitHub Desktop.
Source Maps Splitting test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var fs = require("fs"); | |
var postcss = require("postcss"); | |
var input = fs.readFileSync("test.css"); | |
var output = function (result) { | |
fs.writeFileSync(result.opts.to, result.css); | |
if (result.opts.map && result.map) { | |
fs.writeFileSync(result.opts.to + ".map", result.map); | |
} | |
}; | |
postcss().use(function (css) { | |
css.last.removeSelf(); | |
return css; | |
}).process(input, { | |
from: "test.css", | |
map: true, | |
to: "test-1.css" | |
}).then(output); | |
postcss().use(function (css) { | |
css.first.removeSelf(); | |
return css; | |
}).process(input, { | |
from: "test.css", | |
map: true, | |
to: "test-2.css" | |
}).then(output); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"postcss": "^4.1.11" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.a { | |
color: red; | |
} | |
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0UsV0FBVztDQUNaIiwiZmlsZSI6InRlc3QtMS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIuYSB7XG4gIGNvbG9yOiByZWQ7XG59XG5cbi5iIHtcbiAgY29sb3I6IGdyZWVuO1xufVxuIl19 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.b { | |
color: green; | |
} | |
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBO0VBQ0UsYUFBYTtDQUNkIiwiZmlsZSI6InRlc3QtMi5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIuYSB7XG4gIGNvbG9yOiByZWQ7XG59XG5cbi5iIHtcbiAgY29sb3I6IGdyZWVuO1xufVxuIl19 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.a { | |
color: red; | |
} | |
.b { | |
color: green; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta content="width=device-width" name="viewport"> | |
<title>Source Maps Splitting</title> | |
<link href="./test-1.css" rel="stylesheet"> | |
<link href="./test-2.css" rel="stylesheet"> | |
</head> | |
<body> | |
<header> | |
<h1>Source Maps Splitting</h1> | |
</header> | |
<div class="a">This is a.</div> | |
<div class="b">This is b.</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment