Copied to clipboard

Flag this post as spam?

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


  • Mehrdad 22 posts 71 karma points c-trib
    May 13, 2016 @ 05:37
    Mehrdad
    0

    Creating package, plugin and stylesheet

    I want to create a package in umbraco. everything is alright the only problem is if I want to include a stylesheet, specially created for my plugin, I see the error below:

    The legacy umbraco.cms.businesslogic.web.StyleSheet API is no longer functional for retrieving stylesheets based on an integer ID. Stylesheets are no longer persisted in database tables. Use the new Umbraco.Core.Services.IFileSystem APIs instead of working with Umbraco stylesheets.

    I use umbraco v 7.4.3

  • Jan Skovgaard 11264 posts 23592 karma points MVP 9x admin c-trib
    May 13, 2016 @ 06:32
    Jan Skovgaard
    0

    Hi Mehrdad

    How are you trying to add / access the stylesheet can you share an example? What kind of plugin are you making?

    Adding the stylesheet using a package.manifest file in your package folder under /App_Plugins/YourPlugin should be enough to have the stylesheet loaded.

    Please see https://our.umbraco.org/documentation/Tutorials/Creating-a-Property-Editor/

    As with the javascript injection you can add a CSS file as well by adding

    css: [
        '~/App_Plugins/YourPluginFolder/your.css'
    ]
    

    So if we use the example referenced that would look like this

    {
        //you can define multiple editors
        propertyEditors: [
            {
                /*this must be a unique alias*/
                alias: "My.MarkdownEditor",
                /*the name*/
                name: "My markdown editor",
                /*the icon*/
                icon: "icon-code",
                /*grouping for "Select editor" dialog*/
                group: "Rich Content",
                /*the HTML file we will load for the editor*/
                editor: {
                    view: "~/App_Plugins/MarkDownEditor/markdowneditor.html"
                }
            }
        ]
        ,
        //array of files we want to inject into the application on app_start
        javascript: [
            '~/App_Plugins/MarkDownEditor/markdowneditor.controller.js'
        ],
        css: [
            '~/App_Plugins/YourPluginFolder/your.css'
        ]
    }
    

    But since I don't know what kind of plugin you're making and how you're making it you maybe don't need to setup the entire manifest but can perhaps simply just have this in your package.manifest file

    {
       css: [
           '~/App_Plugins/YourPluginName/css/yourpluginname.css'
       ]
    }
    

    So in the /App_Plugins you should place a folder with the name of your plugin and inside it place a package.manifest file with the CSS reference and you should then also place the referenced css file in this folder too.

    I hope this makes sense :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft