Using CombresMvc with TelerikMvc - asp.net-mvc-3

I am using the Combres combiner/minifier NuGet package. I am also using the following filters:
<filters>
<!-- This filter allows relative urls to be used in Css files like in .NET; e.g. "~/MyFolder/MyPic.png"-->
<filter type="Combres.Filters.FixUrlsInCssFilter, Combres" />
<!-- This filter allows you to define variables in a CSS file and reuse them throughout the file. -->
<filter type="Combres.Filters.HandleCssVariablesFilter, Combres" />
<!-- This filter changes Combres order of ops so that common css variables can be defined in a single
file and used throughout multiple css files, instead of having to define them in each file. -->
<filter type="Combres.Filters.DotLessCssCombineFilter, Combres" />
</filters>
This allows me to define a single CssVariables.css file, and use those variables in any of the other css files (by default, you would have to have variable definitions in each css file, which uses the DotLessCssFilter).
Using the DotLessCssCombineFilter changes the order of operations in Combres so that files are combined FIRST and then variables replaced in the combined file output.
All works extremely well, until I set up the resource set for the telerik stylesheets.
Specifically, it is just the telerik.common.min.css file with an issue. That issue appears on the line:
html .t-dirty{border-color:#f00 pink pink #f00;filter:chroma(color=pink)}
The offending attribute is the: filter:chroma(color=pink)
Removing that attribute stops a null error from occurring in the combres.axd that stops all processing. That attribute is only used on that line in the entire file (and no where else from what I can tell).
All will work well if you remove that attribute.
Enjoy!!

The answer is in the question. I just wanted to share this so no one else had to go through the telerik css file line by line like I did to isolate the issue!
:)
Enjoy!

Related

How to show redundant docs on multiple pages in read the docs

In our read the docs project we have a use case where we need to show some specific docs on multiple pages in the same version of docs. As of now, we do this either by one of the following ways
Copy-pasting the content to each page's rst file
Write it in one of the concerned files with a label and use :std:ref: in rest of the files to redirect it to the main file
I would want to achieve something like writing content only in one file and then showing it (without any redirection for user) in each of the files. Is it possible?
Use the include directive in the parent file.
.. include:: includeme.rst
Note that the included file will be interpreted in the context of the parent file. Therefore section levels (headings) in the included file must be consistent with the parent file, and labels in the included file might generate duplicate warnings.
You can use for this purpose the include directive.
Say that you write the text in dir/text.rst.
The following will include in other documents:
..include :: /dir/text.rst
where the path is either relative (then, with no slash) or absolute which is possible in sphinx (doc)
in Sphinx, when given an absolute include file path, this directive
takes it as relative to the source directory

why do properties in visual studio reference themselves with macro

For example:
As far as i know what is happening here is that jcapimin.c's AdditionalIncludeDirectories metadata property is being set so that it can be referenced later with the %(AdditionalIncludeDirectories) macro in the compilers command line and wherever else you want.
So what I don't understand is why when something down the line retrieves this information using the %(AdditionalIncludeDirectories) macro the information retrieved needs to have %(AdditionalIncludeDirectories) stuck on the end of it
Values of variables (properties, items, metadata, ...) are not automatically inherited in MsBuild, but instead new declarations of the same name override the previous value. So if the %(AdditionalIncludeDirectories) is not appended the new value of AdditionalIncludeDirectories would be just the ....\jpeg;....\jpeg\simd part and the compiler wouldn't be able to find standard library headers etc.
The property pages like you show are just a user interface on top of msbuild, which is easy to check if you open the project file in a text editor so here's a fictive sample of what happens in MsBuild:
<!--Somewhere in the msbuild files with compiler options-->
<ItemGroup>
<AdditionalIncludeDirectories Include="$(VCInstallPath)\include"/>
</ItemGroup>
The code in the above file is eventually included in your project file, and now you want to add directories to the compiler's include search path. Suppose you'd write
<ItemGroup>
<AdditionalIncludeDirectories Include="..\jpeg"/>
</ItemGroup>
then the new value of AdditionalIncludeDirectories is just ..\jpeg. Which is why we use
<ItemGroup>
<AdditionalIncludeDirectories Include="..\jpeg;%(AdditionalIncludeDirectories)"/>
</ItemGroup>
instead so the value is expanded to ..\jpeg;$(VCInstallPath)\include.
Unrelated remark: usually you shouldn't be declaring include directories per file like that; suppose there's a second file which also needs that jpeg include path, you'd have to repeat yourself and write the same thing again. Repeating yourself in programming is nearly always wrong. Declaring the include path on the project level would be a good start. If you also don't want to repeat the same path across projects, look into using property sheets.

MS-Word breaking text into character runs

I have a task where I need to put placeholders in my .docx files and automatically replace them with information that I have. I tried having ${VARNAME} as the placeholder syntax but in the document.xml for that docx file I see $, {, VARIABLE and } broken up into 4 different character runs. On what basis WORD chooses this. Is there a way so that this does not happen?
For replacing placeholder and manipulating docx files I am using docx4j. I am extracting the w:t nodes via XPATH. Recently I tried having placeholder syntax as only $VARNAME and this was not broken up. Can I consider it a foolproof naming convention for placeholder. If not can u suggest how can I tackle this situation. Would introducing custom tags in docx help? Any advice appreciated.
You can never assume that Word will not break up a character run. There is no guaranteed way. You either need to change your approach for extracting the information, by not relying on everything being in a single <w:t> tag, or you need to use a different kind of "target".
Word does not support "custom tags", so that's not an option.
More reliable is to use a ContentControl (std tag). That Word Open XML looks something like this:
<w:sdt>
<w:sdtPr>
<w:alias w:val="test"/><w:tag w:val="test"/><w:id w:val="803656476"/>
<w:placeholder>
<w:docPart w:val="B4C191A9BCFE488E807F3919BC721619"/>
</w:placeholder>
<w:text/>
</w:sdtPr>
<w:sdtContent>
<w:p>
<w:r>
<w:t>Content to be changed by code.</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
The VARNAME would be either the w:alias or the w:tag (your choice). These correspond to the Title and Tag properties, respectively, in the Word UI and object model. There's no way these are going to get broken up.
From there, you get the <w:t> descendant of the <w:sdtContent> element.
If you wish, the content control can be mapped to a Node in a Custom XML Part stored in the document. (Unlike custom tags in the text Word does support adding xml files in the document's Zip package.) In that case, it's possible for your code to address the Custom XML file, rather than the document.xml in order to read/write content. The changes will be reflected in the content controls linked to the nodes.

loading macro files in a directory, transparently

I am looking for a way to separate the repetitive html codes from web pages, and for this I am planning to use the macro functionality. The problem here is for every macro I need to put this macro in a file, or put some of them in a file and include this in the template file.
What I need is to include once just the directory name something like
<#import "/tags/widgetDirectory" as widgets />
here the /tags/widgetDirectory is a directory , and every files here can be seen as a macro defined.
when I need to insert a code part from a file from this directory lets say slide.ftl I will just use
<#widgets.slider />
the system will check for slider.ftl in the /tags/widgetDirectory directory . here the slider.ftl can have <#macro> as first and as last line , or these can transparently added and system can load it as a macro
this will easy my designer work.
Maybe there is better way for doing this kind of widgets/components based web design ?
best regards,
This feature (importing directories) is something that's planned for FM actually... but it won't happen anytime soon. But I guess it can be solved fairly well with a hack right now. Instead of #import, use your own TemplateMethodModelEx, that you could use like <#assign widgets = importDirectory('/tags/widgetDirectory') >. This will return a TemplateHashModel that's also implemented by you and is bound to the directory path. When an item of that hash is get, it uses Environment.getCurrentEnvironment().include. The included file is expected to create a macro with name __main or something. So then you get that variable with Environment.getCurrentNamespace().get("__main") and return it as the result of the hash lookup. Of course this hash should also maintain a cache, so that if the same item is get twice, it wont include the template for the second time, just return the macro extracted earlier. This can be developer further, so that if the include file didn't define __main, then it's supposed that it prints directly to the output, and so it will be included again, when the "tag" is called again.

Can AjaxMinTask output a single file?

I have multiple js input files. How can I make the Microsoft Ajax Minifier (using AjaxMinTask.dll) combine them into a single minified js file?
Instead of using the JsSourceExtensionPattern/JsTargetExtension pair, use the JsCombinedFileName property (and the corresponding equivalents for CSS). If the JsCombinedFileName property is set, it will combine all the input JS files into the path specified by the property, rather than minifying each file separately.
I solved it by doing this:
<Exec Command="echo y| type %(SourceFiles.Identity) >> $(ScriptOutputPath)\$(RootNamespace).debug.js" />

Resources