Can AjaxMinTask output a single file? - visual-studio

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" />

Related

MergeRecord - control name of output

I have a fairly simple process that merges xml files into one or more XML files, using the MergeRecord processor. I'm then converting them into JSON and writing them out with PutFile. The files come out with fabulous names like 79f000ec-9da1-4b59-a0a8-79cc3bb5e85a.
Is there any way to control those file names, or at least give them an appropriate extension?
beforeyour putFile use updateAttribut processor and rename ${fileName}
Exemple :

How to transfer files in order (first come first serve) using apache camel

In my code there are two types of files with extension .csv or .psv and .tigger files. .csv files have more size than .trigger files, so .trigger files are getting transfer in prior to .csv files.
How to make sure that once .csv files are transferred only .trigger files should be transferred.
Am using same single route to transfer both the files.
You can use the sortBy-option of the camel file component. See http://camel.apache.org/file2.html for more information.
One idea is to implement camel's org.apache.camel.component.file.GenericFileFilter and write your filter logic in accept method. Logic should pick all the csv files first and then the trigger files. Use filter option of file component, from end point will be like:
from("file://inbox?filter=myFilter")

T4 Text Transform template creating xx.cs file avoid ErrorGeneratingOutput

I have a t4 template that is outputting to a specified file name. t4 however when run is creating a xx.cs file for each tt file that I have. Within this file is the text "ErrorGeneratingOutput"
Is there a way to prevent this file from being created?
I'm afraid not, no.
When using one of the mechanisms to create specific files, there will always be a dummy stub file.
Typically I set it to be a text file with
<## output extension=".stub.txt" #>
and put some explanatory text in it to the effect that it's a placeholder by putting that text as the body of the template. I then set its build action to 'None' permanently.
I'm not sure what's causing the error, but that's where any error in the rest of your template would get reported typically.
If you just want to prevent the erroneous generated .cs file from compiling until you are finished writing you t4 file, you can set the Build Action property for the .cs file to None and then set it back when you're done

Using CombresMvc with TelerikMvc

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!

Ruby library for manipulating XML with minimal diffs?

I have an XML file (actually a Visual C# project file) that I want to manipulate using a Ruby script. I want to read the XML into memory, do some work on them that includes changing some attributes and some text (fixing up some path references), and then write the XML file back out. This isn't so hard.
The hard part is, I want the file I write to look the same as the file I read in, except where I made changes. If the input file used double quotes, I want the output to use double quotes. If the input had a space before />, I want the output to do the same. Basically, I want the output to be the same as the input, except where I explicitly made changes (which, in my case, will only be to attribute values, or to the text content of an element).
I want minimal diffs because this project file is checked into version control -- and because the next time I make a change in Visual Studio, it's going to rewrite it in its preferred format anyway. I want to avoid checking in a bunch of meaningless diffs that will then be changed back again in the near future. I also want to avoid having to open the project in Visual Studio, make a change, and save, before I can commit my Ruby script's changes. I want my Ruby script to just make its changes, nothing more.
I originally just parsed the file with regexes, but ran into cases where I really needed an XML library because I needed to know more about child elements. So I switched to REXML. But it makes the following undesirable changes to my formatting:
It changes all the attributes from double quotes to single quotes.
It escapes all the apostrophes inside attribute values (changing them to &apos;).
It removes the space before />.
It sorts each element's attributes alphabetically, rather than preserving the original order.
I'm working around this by doing a bunch of gsub calls on REXML's output, but is there a Ruby XML-manipulation library that's a better fit for "minimal diff" scenarios?
You can build your own SAX parser (using Nokogiri, for example, it's very easy and I recommend to use it) to parse your XML file, change some data in it, and flush the processed XML file with your own customized, built from scratch, XML generator. The bad news is, you have to build a tiny XML library and generator routine in this case, so it is not an ordinary task.
Another way: don't build the SAX parser, but write an XML generator. Parse XML with your favourite library, change what you need to change and generate anything you want. You just need to recursively walk through all nodes in your document and output them within your conventions.

Resources