0

I'm trying to make a theme for a website. So I setup a Chrome extension,

this is the manifest:

{
      "manifest_version": 2,

      "name": "Beard's Material Discord theme for chrome",
      "version": "1.3.5",
      "description": "an extension to make discord more material",

      "background": {
          "scripts": ["background.js"],
          "persistent": true
      },

      "content_scripts": [ {
        "css": ["styles.css"],
        "matches": ["https://discordapp.com/*"]

      } ]


    }

Here is the background.js

    chrome.runtime.onInstalled.addListener(function (object) {
    chromez.tabs.create({url: "http://gonova.gq/beardstheme"}, function (tab) {
        console.log("New tab launched with http://gonova.gq/beardstheme");
    });
});

And here is the styles.css

@import url('https://rawgit.com/BeardDesign1/Material-design-theme-ressources/master/code-files/update/version.css');

So here is the issue. The extension fully works when I paste the css from "https://rawgit.com/BeardDesign1/Material-design-theme-ressources/master/code-files/update/version.css" it completely works. But when I use the @import command nothing happends.

Is this because Chrome doesn't allow that? Or am I doing it completely wrong.

  • Modern https sites usually block foreign content by using CSP so if this is the case there should be an error in the console or in the network panel of devtools. – wOxxOm Mar 26 '17 at 05:01
  • You could try adding - [Web Accessible Resources](https://developer.chrome.com/extensions/manifest/web_accessible_resources) to be able to include the `CSS` to the manifest. And try reading [Programmatic injection](https://developer.chrome.com/extensions/content_scripts#pi) and [insertCSS](https://developer.chrome.com/extensions/tabs#method-insertCSS) as stated in a related SO [post](http://stackoverflow.com/a/11554116/5995040) on how to inject CSS using content script file in Chrome extension. Hope this helps. – Mr.Rebot Mar 26 '17 at 08:01
  • What *exactly* is shown in the [various appropriate consoles for your extension](http://stackoverflow.com/a/38920982/3773011) when you load and execute your extension? – Makyen Mar 27 '17 at 05:06

0 Answers0