forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postcss.config.js
47 lines (40 loc) · 1.29 KB
/
postcss.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
var mapUrl = require("postcss-url-mapper");
const debug = require("debug")("launchpad");
function mapUrlProduction(url) {
const newUrl = url
.replace(/\/images\//, "chrome://devtools/skin/images/debugger/")
.replace(/\/mc\//, "chrome://devtools/skin/images/");
debug("map url", { url, newUrl });
return newUrl;
}
function mapUrlDevelopment(url) {
const newUrl = url
.replace(/mc/, "mc/devtools/client/themes/images")
.replace(/(chrome:\/\/|resource:\/\/)/, "/mc/")
.replace(/devtools\/skin/, "devtools/client/themes")
.replace(/devtools\/content/, "devtools/client");
debug("map url", { url, newUrl });
return newUrl;
}
module.exports = ({ file, options, env }) => {
if (env === "production") {
return {
plugins: [mapUrl(mapUrlProduction)]
};
}
return {
plugins: [
require("postcss-bidirection"),
require("autoprefixer")({
browsers: ["last 2 Firefox versions", "last 2 Chrome versions"],
flexbox: false,
grid: false
}),
require("postcss-class-namespace")(),
mapUrl(mapUrlDevelopment)
]
};
};