Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 965628f

Browse files
authored
Merge pull request #997 from devtools-html/components-postCSS
devtools-components postCSS config
2 parents cd71c58 + d1788f0 commit 965628f

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

packages/devtools-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "devtools-components",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "DevTools HTML Components",
55
"main": "index.js",
66
"scripts": {
77
"copy-assets": "node bin/copy-assets",
88
"license-check": "devtools-license-check",
9-
"storybook": "start-storybook -p 9002 -c .storybook -s ./src",
9+
"storybook": "NODE_ENV=storybook start-storybook -p 9002 -c .storybook -s ./src",
1010
"test": "jest"
1111
},
1212
"author": "Jason Laster",

packages/devtools-components/postcss.config.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,36 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
// Dumb export so launchpad does not throw.
6-
module.exports = () => ({});
5+
const mapUrl = require("postcss-url-mapper");
6+
const MC_PATH = "chrome://devtools/skin/images/devtools-components/";
7+
const EXPRESS_PATH = "/devtools-components/images/";
8+
9+
function mapUrlProduction(url, type) {
10+
return url.replace("/images/arrow.svg", MC_PATH + "arrow.svg");
11+
}
12+
13+
function mapUrlDevelopment(url) {
14+
return url.replace("/images/arrow.svg", EXPRESS_PATH + "arrow.svg");
15+
}
16+
17+
module.exports = ({ file, options, env }) => {
18+
// Here we don't want to do anything for storybook since we serve the images thanks
19+
// to the `-s ./src` option in the `storybook` command (see package.json).
20+
if (env === "storybook") {
21+
return {};
22+
}
23+
24+
// This will be used when creating a bundle for mozilla-central (from devtools-reps
25+
// or debugger.html).
26+
if (env === "production") {
27+
return {
28+
plugins: [mapUrl(mapUrlProduction)]
29+
};
30+
}
31+
32+
// This will be used when using this module in launchpad mode. We set a unique path so
33+
// we can serve images from express.
34+
return {
35+
plugins: [mapUrl(mapUrlDevelopment)]
36+
};
37+
};

packages/devtools-components/src/tree.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
user-select: none;
2323
}
2424

25-
.tree button {
26-
display: block;
27-
}
28-
2925
.tree .tree-node {
3026
display: flex;
3127
}

0 commit comments

Comments
 (0)