Minify

26 views
Skip to first unread message

Aguxtin

unread,
Jan 20, 2015, 4:19:33 PM1/20/15
to shar...@googlegroups.com
Is there a way to minify per file, or per assembly ?

In my current scenario I have an assembly that generates many individual files.

I would like to be able to minify them individually, if possible, or globally. And preferably to be able to do it with a simple toggle.

Let me know !

Cordially, Agustin

Dan-el Khen

unread,
Jan 20, 2015, 4:36:34 PM1/20/15
to shar...@googlegroups.com
Hi, 

There are two ways, one creates bundles from files:

[assembly: JsMergedFile(Sources=[...], Filename="...", Minify=true)]

The other one is global using:
[assembly: JsExport(Minify=true)]

You might have an issue of having the non minified and minified automatically since the JsExport.Minify flag is global. So you can either use #IF compiler directive with two configurations (every compilation will create either minified or non-minified js files), or generate a [JsMergedFile] line of code for each file, which will give you both.

Best regards
Dan-el
SharpKit


--
You received this message because you are subscribed to the Google Groups "SharpKit Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharpkit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Agustin Garzon

unread,
Jan 21, 2015, 7:17:49 AM1/21/15
to shar...@googlegroups.com
Hey Dan, thanks for the reply. Tried the global setting and it sort of worked. Is it possible to have minification refactor names so they are shorter ?
Not saying obfuscation. Most major scripts do this refactoring on min files, savings would be larger. 

Also, thinking that any minification, good as it is, would make it hard to debug, I'm thinking how to approach this, and it's a little convoluted and error prone, do you have a good suggestion as to how to deal with a debug / production scenario ?


--
You received this message because you are subscribed to a topic in the Google Groups "SharpKit Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sharpkit/_3YVgkuitaY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sharpkit+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Agustin.

"You only need to change your direction," said the cat, and ate it up.

Dan-el Khen

unread,
Jan 22, 2015, 8:06:54 AM1/22/15
to shar...@googlegroups.com
Well many minifiers today generate source maps, which allow you to debug your original file over the minified file. SharpKit generates source maps, but it will map the files to your cs files and not to your unminified js files. You can use an external minifier tool for this.

Otherwise, you can do what I usually do, add a query string / config option that sends the page with the original js files without minification or consolidation - for debugging purposes.

Best regards
Dan-el
SharpKit

Agustin Garzon

unread,
Jan 22, 2015, 8:11:10 AM1/22/15
to shar...@googlegroups.com
As for option 2, you mention query string / config etc. For this you need 2 sets of files per JS file, one minified and one expanded. We can't do this with sharpkit, right ? Have to have SK export unminified, and plug your own minifier somewhere in your dev pipeline, is that right ? 

As for option 1, I want to play with the source maps you mention, any thread / tutorial on how to jump start that ?

Thanks !

Dan-el Khen

unread,
Jan 22, 2015, 8:13:30 AM1/22/15
to shar...@googlegroups.com
Regarding option 2 - you can do it if you don't use JsExport.Minify - but instead use JsMergedFile(Minify=true) - this allows you as many sets of minified / non minified files as you want.

option 1 - yes please go through the instructions here:
Under title: "Debugging".

Best regards
Dan-el
SharpKit
Reply all
Reply to author
Forward
0 new messages