Esempio n. 1
0
        /// <summary>
        /// Takes a CssDocument and returns the CSS output
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        public string ToCss(CssDocument document)
        {
            var stringBuilder  = new StringBuilder();
            var rulesets  = GroupElements(new List<CssElement>(document.Elements));

            foreach(var ruleset in rulesets)
            {
                if(ruleset.InsertContent!=null)
                {
                    stringBuilder.Append(string.Format("{0}\r\n", ruleset.InsertContent));
                }
                else
                {
                    var propertyString = GetPropertyString(new List<CssProperty>(ruleset.Properties));
                    stringBuilder.Append(string.Format("{0} {{{1}}}\r\n", ruleset.Identifiers, propertyString));
                }
            }
            return stringBuilder.ToString();
        }
 public CssDocument BuildCssDocument(ElementBlock lessRootElementBlock)
 {
     document = new CssDocument();
     BuildCssDocumentImpl(lessRootElementBlock, new List<string>());
     return document;
 }
 private void BuildCssDocument()
 {
     _cssDocument = new CssDocument();
     BuildCssDocumentImpl(elementBlock, new List<string>());
 }