More in this section

Forums / General Discussions / Including a stylesheet with a module

Including a stylesheet with a module

5 posts, 0 answered
  1. Joe Keller
    Joe Keller avatar
    48 posts
    Registered:
    07 Apr 2010
    09 Sep 2010
    Link to this post
    Two questions on this topic.

    1.) I would like to find out what the best way to include a stylesheet specifically for the templates in my module along with my module installation

    2.) Is there an easy way from Sitefinity to allow a semi-techincal user to edit the stylesheet directly from sitefinity.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Sep 2010
    Link to this post
    Hi Joe Keller,

    1. In AssemblyInfo you can add  reference to your stylesheets

    [assembly: WebResource("Telerik.Samples.Resources.Themes.MyBackenTheme.Global.Layout.css", "text/css", PerformSubstitution = true)]

    You can link the stylesheet by using ResourceLinks control used for linking resources such as stylesheets, images and java script files. The control will automatically load the resource from the currently selected backend theme.

    2. Sitefinity does not provide code editor for the backend.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Joe Keller
    Joe Keller avatar
    48 posts
    Registered:
    07 Apr 2010
    15 Sep 2010
    Link to this post
    So, I guess my workaround for this issue will be as follows:

    1.) embed the stylesheet as a resource
    2.) During the module install I will write the stylesheet out to a styles directory in the site
    3.) Then, I will end up making my own editor to allow the end-users to make changes to the stylesheet from the modules administrative section (I might extend the content editor to do this.. not sure yet)

    But, my basic goal is to have a stylesheet deployed when I install the module, and then allow a semi-technical designer to make changes to the stylesheet without needing access to the site in visual studio or even accessing the file system directly.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    15 Sep 2010
    Link to this post
    Hello Joe Keller,

    If the stylesheet is embedded resource to the module you cannot edit it or apply changes to it, because this requires to recompile the assembly. You can use ResourceLinks control and make reference to resource that are not compiled, located in your project.. This will allow you to update them through an editor.

    <sitefinity:ResourceLinks id="resourcesLinks" runat="server">
        <sitefinity:ResourceFile Name="Skins/Foo.css" />
    </sitefinity:ResourceLinks>


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Joe Keller
    Joe Keller avatar
    48 posts
    Registered:
    07 Apr 2010
    15 Sep 2010
    Link to this post
    Hi Ivan,

    Thank you for your continued interest and responses on this thread and forum.

    I only plan on embedding the stylesheet as resource so that it is part of the module library. Once I run the install method in the module I will use the file system and write an actual local copy of the stylesheet out of the resource into a physical directory in the site.

    I will have the templates in the module reference the stylesheet in the local file system, not the one in the resources, that way I can then allow administrators to make changes to the stylesheet.

    Joe


5 posts, 0 answered