grunt-ts
grunt-ts copied to clipboard
Offer minimize html support for the typescript html views
I like the html support you have for grunt-ts and have used the features in the latest beta to create a custom template ts file.
A nice option would be to enable html minification so that the generated js would be smaller on larger views.
Nice work on grunt-ts!
Are you talking about the htmlOutputTemplate option?
On Thu, Jul 30, 2015 at 11:21 AM johnman [email protected] wrote:
I like the html support you have for grunt-ts and have used the features in the latest beta to create a custom template ts file.
A nice option would be to enable html minification so that the generated js would be smaller on larger views.
Nice work on grunt-ts!
— Reply to this email directly or view it on GitHub https://github.com/TypeStrong/grunt-ts/issues/270.
Yes I use htmlOutputTemplate and have a views task with the pattern to find all relevant html files with no source and compile set to false (a different build config builds all the ts including the html ts files).
maybe some htmlmin options support in options so that we can optionally minify the html that will be within the ts property.
+1, that would be really great. At the moment I prefer loading angular templates the "traditional" way, because I can mimimize them. If I could use htmlmin in grunt-ts, compiling to .ts would be the superior way for templates.
Hi John and Hoeni,
I've been thinking about this for a little while. In my opinion minification has no place within grunt-ts, as grunt-ts does one thing: compilation to typescript.
I personally export to AMD modules and then the minification can be handled by means of my build system, in other cases a grunt watch task could pick up .ts files and minify html strings in them, but it's really not a concern of grunt-ts to minify html, as then we'd have to start minifying css as well, and there are a bazillion ways to do that, and so on.
I'd say more opinions are needed on this topic though.
@nycdotnet any opinions?
Hi sethx,
I don't think that grunt-ts should do the minification, as this is surely no fit (one tool, one task!). But it should spawn another minification tool for this.
As an example for a similar task see the ngtemplates module (https://github.com/ericclemmons/grunt-angular-templates). It takes HTML template files to build one huge (angular-)JS file from. It is able to use ngmin for compressing the templates to be stored in the JS.
I'll investigate bundling html-min as it's already a grunt plugin. that makes more sense... But that requires config changes i'd guess. Am quite busy these days, hope to get to it during the weekend.
Sorry, it was htmlmin in ng-templates not "ngmin" anyway :-)
I would be willing to allow a plugin. Perhaps by passing a function in the Gruntfile to the html feature. Would that be useful? That way we could provide the support but not have to be in that business. Make sense?
I'd advocate spawning off to a plugin to minify the html (spoke about this before) but I am not used to grunt yet, so docs / examples would be useful in my case :)