Example #1
0
 /// <inheritdoc />
 public virtual async MorestachioDocumentResultPromise RenderAsync(object data,
                                                                   CancellationToken cancellationToken,
                                                                   IByteCounterStream targetStream = null)
 {
     return(await Render(data, cancellationToken, async (stream, context, scopeData) =>
     {
         await MorestachioDocument.ProcessItemsAndChildren(new[] { Document }, stream,
                                                           context, scopeData);
     }, targetStream));
 }
Example #2
0
        /// <inheritdoc />
        public override async ItemExecutionPromise Render(IByteCounterStream outputStream, ContextObject context, ScopeData scopeData)
        {
            using (var tempStream = outputStream.GetSubStream())
            {
                await MorestachioDocument.ProcessItemsAndChildren(Children, tempStream, context, scopeData);

                var lessCode = tempStream.Read();
                outputStream.Write(Less.Parse(lessCode, new DotlessConfiguration()
                {
                    CacheEnabled = false,
                }));
            }
            return(Enumerable.Empty <DocumentItemExecution>());
        }