Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[SugarCube] StoryIncludes doesn't work with the Stylesheet passage?

Trying to put my only stylesheet passage in an external .tw file that gets included. External js and widget passages are working just fine but the stylesheet passage seems to be a no-go. I'm guessing this is a known issue but Google didn't turn anything up for and the various wikis haven't mentioned this as a limitation.

In Twine 1.4.2 on a mac. Using latest version of SugarCube from that website. Checked the css passage using Sublime Text and it looks ok.

Comments

  • I think you may have a problem with your stylesheet.

    I just created a new story, deleted all the existing passages and named it stylesheet.tws, then I added the following stylesheet passage to it:
    body {
    	background-color: green;
    }
    

    I then created a second new story, named it main.tws, added a StoryInclues special passage to it that referenced the stylesheet.tws file. When I use both the Test and Build options the resulting HTML had a green background.
  • Thanks, greyelf. In particular, I should mention that it works if I add the stylesheet in my original file or if I put it in a .tws, but NOT if I leave it in a .tw (txt) file. I prefer to work with my includes for styles and code open in Sublime Text and just use the twine editor for compiling all of it.

    Should that work?
  • To include a text file via StoryIncludes the build code has to first convert (parse) the file's contents into the equivalent of a tws file in memory, so if there is a error in the text file then there could be issues with the conversion.
  • Have you run the Stylesheet through the W3C's validator?

    https://jigsaw.w3.org/css-validator/
  • I assume you've tagged the passage properly in your Twee file? For example:
    :: My Awesome Styles [stylesheet]
    body {
    	background-color: green;
    }
    
  • I did tag it as a stylesheet and it does validate to CSS Level 3. Works fine if it's in a tws project, just not on it's own. I may investigate more later. I also found out that cyrillic characters work if in .tws projects but not when included as twee text files.
  • Does it have to be built into the html at all, rather than just being an external stylesheet? I've never worked with twee files to be honest. Anything that I didn't want in tws I shifted into standalone files so that it can be replaced without requiring a rebuild.
  • Brad wrote: »
    I also found out that cyrillic characters work if in .tws projects but not when included as twee text files.
    That is probably simply an encoding issue. I assume you've used the native code page? If so, try switching your Twee source file to the UTF-8 encoding instead.

    IIRC, the Twine 1 text editing controls automatically convert to the proper encoding when you type/paste into them (or it's done after, the point is that it gets done), which is why it works there.


    Also, can you attach your Twee source file here? It doesn't need to include more than the CSS passage which is giving you trouble (if there's more in there you'd rather not share), but it should be the actual file. I'll see if I can't figure out what's wrong.
  • For posterity, I wanted to mention that I eventually got this working. IIRC, it was a smart-quote character that caused the problem. I used a plugin for Sublime Text that highlights any extended characters.
Sign In or Register to comment.