Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Sticking a CSS file inline

Deplate
kLy
2007-09-24
2013-04-17
  • kLy
    kLy
    2007-09-24

    Hi

    Is there some way to do this currently? The only thing I see is the --css option that copies the CSS to the current directory. I know it's very anti-css philosophy to stick everything into the HTML inline but in some cases you'd just like a single portable HTML file that you can email without the extra baggage.

    Thanks!

     
    • Tom Link
      Tom Link
      2007-09-24

      You can use the #Native environment to include css in the html output.

      If you mean by sticking a file inline, to take an existing css file and to include it in the output. You can use:

      #WITH file=name.css: Native

      to insert the file but you still have to figure out a way to insert the appropriate html tags before and after the css.

      I think something like this should do:

      #Native type=pre slot=css <<-
      <style type="text/css">
      <!--
      -
      #WITH file=name.css: Native type=pre slot=css
      #Native type=pre slot=css <<-
      -->
      </style>
      -

      You can define the position where to insert the css file by setting the type and slot arguments. See: http://deplate.sourceforge.net/Internals.html

       
    • kLy
      kLy
      2007-10-08

      Aah... thanks! :)

      Not to be a pain (since you went out of your way to help), but just as a constructive suggestion: this seems a little inflexible and troublesome... it may be quite useful to have an option in the command line to imbed the files in a future version? Right now you'll have to do this for a number of CSS files which can get quite long. Also, if this is made as a module or output formatter, you can then just include the CSS as per normal in the markup, but switch to having it embedded if you want a single file or keep it as separate CSS files as per well umm... standard CSS :) Not sure if something like this is widely useful but I'd find it personally very useful.

      Just a by the by, are there many users of Deplate out there professionally? Because it is really a VERY powerful tool, with a zillion more possibilities than markdown or multi-markdown, though MMD seems to have been adopted a lot more commonly throughout the web.

      Thx!

       
      • Tom Link
        Tom Link
        2007-10-12

        > it may be quite useful to have an option in the command
        > line to imbed the files in a future version?

        If you're willing to test the cvs version, there is no a cssInclude
        (BOOLEAN) variable/parameter/option that is supposed to include the CSS
        files in the output file. I ran only a few test.

        > Right now you'll have to do
        > this for a number of CSS files which can get quite long

        It would have been possible to use #Foreach, I guess, but then there
        would have still been the link rel="stylesheet" tags in the header.

        > Not sure if something like this is widely useful

        It would be even more useful if there were a standard way to include
        images.

        > the by, are there many users of Deplate out there professionally?

        Professionally?

        > markdown

        Markdown has the advantage of converters in different programming
        languages. It seems though that there are diverging efforts to extend
        markdown. I didn't know of multi-markdown yet. Somebody recently
        informed me about maruku (I'm not sure how its reinterpretation of
        markdown relates to MMD) and pandoc which seem both interesting too.
        reStructuredText is also widely used. I personally find this quite
        interesting, although I personally don't like the markdown markup too
        much. Things like the use of single asterisks and underscores, lists
        starting at column 1, inconsistent use of backslashes to escape
        characters, context-dependent translations of certain characters that
        could be HTML or not, IMHO provoke ambuiguities.

         
    • kLy
      kLy
      2007-10-15

      Great, thanks! :) Will give it a try when I get a chance.

       
    • kLy
      kLy
      2007-10-15

      As for embedding images, does a "data://" url work? Or I guess it might not be widely supported enough.

       
      • kLy
        kLy
        2007-10-15

        Okay, looks like this is supported by every major browser out there minus IE (surprise, surprise), which I guess means a no go :/