forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postcss.config.js
45 lines (38 loc) · 1.12 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
/* 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\//,
"resource://devtools/client/debugger/new/images/"
);
debug("map url", { url, newUrl });
return newUrl;
}
function mapUrlDevelopment(url) {
const newUrl = url
.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("autoprefixer")({
browsers: ["last 2 Firefox versions", "last 2 Chrome versions"],
flexbox: false,
grid: false
}),
mapUrl(mapUrlDevelopment)
]
};
};