blob: 260d367c4235aba08233a1d6074328f089299c78 [file] [log] [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WARNING: don't use this rollup plugin outside of inspector_overlay.
// See README for special constraints the overlay has.
// eslint-disable-next-line import/no-default-export
export default function loadCSS() {
return {
name: 'loadCSS',
/**
* @param code
* @param id
*/
transform(code, id) {
if (id.endsWith('.css')) {
return {
code: `
const style = new CSSStyleSheet();
style.replaceSync(${JSON.stringify(code)});
export default style;
`,
map: null,
};
}
return;
},
};
}