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.
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.
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.
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
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
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
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
Ah, now I see what you mean. Thanks!
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
is working on a reply...