コード例 #1
0
        private Task OnPreCompile(ISite site)
        {
            m_Site = site;

            AssetsHelper.AddTextAsset(Resources.code_snippet_css, site.MainPage, CSS_FILE_PATH);
            AssetsHelper.AddTextAsset(Resources.code_snippet_js, site.MainPage, JS_FILE_PATH);

            m_SnippetFileIds = new List <string>();
            m_UsedTabIds     = new Dictionary <IPage, List <string> >();
            m_UsedSnippetIds = new Dictionary <IPage, List <string> >();

            if (!string.IsNullOrEmpty(m_Settings.SnippetsFolder))
            {
                try
                {
                    m_SnippetsFolder = site.MainPage.FindFolder(PluginLocation.FromPath(m_Settings.SnippetsFolder));
                }
                catch (AssetNotFoundException)
                {
                    throw new PluginUserMessageException($"Failed to find the folder for snippets: '{m_Settings.SnippetsFolder}'");
                }

                foreach (var snipAsset in m_SnippetsFolder.GetAllAssets())
                {
                    m_SnippetFileIds.Add(snipAsset.Id);
                }
            }

            return(Task.CompletedTask);
        }
コード例 #2
0
        private Task OnPreCompile(ISite site)
        {
            if (!m_Settings.EmbedStyle)
            {
                var css = (Formatter as HtmlClassFormatter).GetCSSString();
                css = css.Substring("body{background-color:#FFFFFFFF;} ".Length);//temp solution - find a better way
                AssetsHelper.AddTextAsset(css, site.MainPage, CSS_FILE_PATH);
            }

            return(Task.CompletedTask);
        }
コード例 #3
0
        private Task OnPreCompile(ISite site)
        {
            AssetsHelper.AddTextAsset(Resources.responsive_image, site.MainPage, CSS_FILE_PATH);

            return(Task.CompletedTask);
        }