Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Frans de Jong 548 posts 1840 karma points MVP 4x c-trib
    Jan 05, 2018 @ 09:55
    Frans de Jong
    0

    Style the preview

    Hi guys,

    Awesome package again!! Thanks a lot!

    I have a question. Is there a default way to add css to the preview? I'd like the content stack preview in the backoffice to look like the front end page. I'd like to stay away from inline styling.

    I could of course add my css to the package manifest but is that the way to go? feels a bit like a hack...

    Edit: I could add a inline style block in the partial when its not a front end request. That could work.

    Frans

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 05, 2018 @ 10:03
    Lee Kelleher
    1

    Hi Frans,

    There isn't a built-in way to add CSS with StackedContent.

    I'd recommend using the package.manifest to include your own CSS. I don't see it as a hack, it's an Umbraco extensibility point.

    Matt wrote a post about it a while ago... https://24days.in/umbraco-cms/2015/umbraco-7-back-office-tweaks/

    Cheers,
    - Lee

  • Frans de Jong 548 posts 1840 karma points MVP 4x c-trib
    Jan 05, 2018 @ 10:09
    Frans de Jong
    0

    Hi Lee,

    With a hack I was referring more to when I update StackedContent I'll probably overwrite the manifest.

    Isn't the styling in the partial the preferred way?

    Frans

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 05, 2018 @ 10:22
    Lee Kelleher
    100

    Hey Frans,

    You can go with inline styling, (it's up to you). I like to go with my own package.manifest for any back-office tweaks - that's my personal preference.

    I'd advise not to modify the StackedContent one, as you say it would get overwritten on upgrade.

    Cheers,
    - Lee

  • Frans de Jong 548 posts 1840 karma points MVP 4x c-trib
    Jan 05, 2018 @ 10:23
    Frans de Jong
    0

    Ah, now I see what you mean. Thanks!

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Jan 05, 2018 @ 10:24
    Nik
    2

    Hi Frans,

    What I do with Stacked content is include my own package in app_plugins. I call it something like "BackofficePreviewHelpers" or "StackedContentPreviews".

    The package manifest simply references a css file which is then loaded by Umbraco. This css files is created via my scss build process and only includes my stylings for back office previews of stacked content (and some other custom bits). This saves me duplicating styles/variables/etc for the scss and allows it to be used to generate my frontend and my back end styles.

    This means you don't have to edit stacked content at all but still allows you to include your styles in the back office.

    Thanks,

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft