Any way to link to a Stylesheet to another?

edited February 2014 in Style Development
Is there any way to link Stylesheets to one another? I'm doing a big project and I like being really neat and it would be very useful if I could just link multiple style sheets all into one. I do use comments, but it's not enough. I've only a header and nav menu for this website and already have 300+ lines JUST FROM THOSE and I'm not even done with them yet. It's really hard to look for something also while looking through all of it.

Comments

  • edited February 2014
    nm
  • edited February 2014
    https://developer.mozilla.org/en-US/docs/Web/CSS/@import#Examples
    @import url("http://blah.com/style.css");
    However, userstyles.org doesn't allow @import - http://userstyles.org/help/coding

    No @import directives. If an @import is done to a slow-loading server, it will cause browser hangs.
  • "If an @import is done to a slow-loading server, it will cause browser hangs." What if it's a website like Facebook, Google, Twitter, or Steam?
  • Hello,

    Is there any way to @import a local stylesheet? I've tried @import 'user.css'; which is the Stylish name of the css, to no avail.

    I've also tried url("file:///C:\Users\Paul_2\AppData\Roaming\Opera\Opera\styles\user\_user dark.css"), which points to another css on the local machine, to no avail.

    In both cases it was the first line of the css.

    Thanks.
  • Use forward slashes.
  • edited July 2014
    Thanks, but no luck using
    @import url(file:///C:/Users/Paul_2/Desktop/drudge.css) ;

    I thought it was maybe because the target was an Opera css rather than mozilla, but I copied a file off userstyles.org and it doesn't work either. So neither external file or internal Stylish imports are working.

    BTW, I'm setting the site specs of the css I want to import to NULL, assuming that the site specs of the controlling css will override it.
  • Works fine for me--just a local file like any other. To be sure the file name is correctly specified, open the file in your browser and use what's in the location bar (URL).
  • edited July 2014
    Thanks again. No luck yet, and added quotes to that filespec. I should mention that I'm using Stylish on Slimjet, which uses the Chrome base.
  • I don't use that combo (Chrome with Stylish), but I know others have used @import with Stylish in Chrome with success. I'd suggest starting with just the @import then adding whatever else you've got specified one by one in order to see what might be getting in the way.
  • edited July 2014
    I should mention that I'm using Stylish on Slimjet, which uses the Chrome base.
    Not gonna happen. In Webkit browsers, Stylish grafts STYLE elements onto the document object model. They are no different than STYLE elements that arrive from the site as part of the web page, and have no more access to the local file system than does the web site.
  • Anything hideheader (aka "NotAProgrammer") says, you can pretty much discount 99 times out of 100.

    https://github.com/JasonBarnabe/stylish/issues/29 (first sentence) -- says nothing about whether "slimjet" would also work however
  • edited July 2014
    Don't be stupid. Access to the filesystem is not at all the same as access to a server.

    When you don't know what you're talking about, stop talking and listen until you learn something worth saying.
  • edited July 2014
    Appreciate the input. Maybe that is the cause. I placed the linked css on a remote server (actually the same machine, but accessed through a web server) and it worked. Same css through a filesystem spec doesn't work, using the spec: url("file:///C:/Users/Paul_2/Desktop/drudge.css"). The address is correct, as Slimjet (Chrome) will open the raw filespec in the address bar. That would mean the browser can handle it, but the extensions cannot, unless I'm making some other error.
  • edited July 2014
    That would mean the browser can handle it, but the extensions cannot, unless I'm making some other error.
    It's completely unrelated to the extension. Basically, whatever else a document can load depends on where that document came from. If your stylesheet came from the network, it can't access files in your filesystem.

    Webkit-ty Stylish adds elements to the webpage; the website is the security principal for loading subdocuments like stylesheets and images. Unless that top-level document was loaded from a file: URL, your Stylish stylesheet (and any stylesheets it @imports) won't have access to the filesystem. Firefox-y Stylish passes stylesheets to the browser and the browser itself applies the styles as needed without changing the page's DOM; file: origins are OK because the browser, not the web page, is the security principal.

    You can work around the restriction by "hosting" your stylesheets in an otherwise empty extension, and retrieving them with chrome: URLs. This is no longer practical in Chrome - Google has made it ridiculously difficult to use your own private extensions in Chrome - but it's still feasible in Opera.
    https://forum.userstyles.org/discussion/34792/how-to-use-local-image#Item_5
  • Ok, that second paragraph makes sense to me. And in that case using Stylist instead of Stylish wouldn't make a difference either. I could solve this by running my local web server all the time, but probably won't at least at this time. Thanks again.
  • ...
    Congrats on proving yet again why using Chrome or one of its relatives is never a good idea.
    blah blah blah
    Your reading comprehension is apparently as good as ever. All I said was that Stylish in Chrome supports @import, as reported by others. And now we have more confirmation that this is the case. As to whatever else Chrome fails to do--such as with a file system, I have no knowledge of or interest in since I don't use that piece of crap.

    Now that I've corrected you--again, I'll return to ignoring you completely.

    Earl
  • I found I could successfully link to the css by uploading it to dropbox. Onedrive and keep and share had failed.
  • edited July 2014
    The MIME type must be text/css or the browser will ignore it. Some file sharing sites ignore the extension and return all files as text/plain, which won't do.
  • A ha. Looks like dropbox has done their homework. Thanks.
Sign In or Register to comment.