{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Razor/issues/444","labels_url":"https://api.github.com/repos/aspnet/Razor/issues/444/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Razor/issues/444/comments","events_url":"https://api.github.com/repos/aspnet/Razor/issues/444/events","html_url":"https://github.com/aspnet/Razor/issues/444","id":93069743,"number":444,"title":"Proposal: Razor Markup Minification","user":{"login":"GuardRex","id":1622880,"avatar_url":"https://avatars.githubusercontent.com/u/1622880?v=3","gravatar_id":"","url":"https://api.github.com/users/GuardRex","html_url":"https://github.com/GuardRex","followers_url":"https://api.github.com/users/GuardRex/followers","following_url":"https://api.github.com/users/GuardRex/following{/other_user}","gists_url":"https://api.github.com/users/GuardRex/gists{/gist_id}","starred_url":"https://api.github.com/users/GuardRex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuardRex/subscriptions","organizations_url":"https://api.github.com/users/GuardRex/orgs","repos_url":"https://api.github.com/users/GuardRex/repos","events_url":"https://api.github.com/users/GuardRex/events{/privacy}","received_events_url":"https://api.github.com/users/GuardRex/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/Razor/labels/0%20-%20Backlog","name":"0 - Backlog","color":"CCCCCC"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/aspnet/Razor/milestones/9","html_url":"https://github.com/aspnet/Razor/milestones/Backlog","labels_url":"https://api.github.com/repos/aspnet/Razor/milestones/9/labels","id":830814,"number":9,"title":"Backlog","description":"","creator":{"login":"danroth27","id":1874516,"avatar_url":"https://avatars.githubusercontent.com/u/1874516?v=3","gravatar_id":"","url":"https://api.github.com/users/danroth27","html_url":"https://github.com/danroth27","followers_url":"https://api.github.com/users/danroth27/followers","following_url":"https://api.github.com/users/danroth27/following{/other_user}","gists_url":"https://api.github.com/users/danroth27/gists{/gist_id}","starred_url":"https://api.github.com/users/danroth27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danroth27/subscriptions","organizations_url":"https://api.github.com/users/danroth27/orgs","repos_url":"https://api.github.com/users/danroth27/repos","events_url":"https://api.github.com/users/danroth27/events{/privacy}","received_events_url":"https://api.github.com/users/danroth27/received_events","type":"User","site_admin":false},"open_issues":60,"closed_issues":1,"state":"open","created_at":"2014-10-17T22:01:31Z","updated_at":"2015-10-21T00:20:16Z","due_on":null,"closed_at":null},"comments":24,"created_at":"2015-07-05T02:55:14Z","updated_at":"2015-12-10T08:53:57Z","closed_at":null,"body":"**Problem:** Razor directives require line feeds in markup that don't allow for simple Gulp HTML minification of views.\r\n\r\n**Suggestion:** Add line termination character option (semicolon?) for Razor directives that will allow the Razor parser to work with minified directives.\r\n\r\nFor HTML minification of Razor views with Gulp, one can setup a folder of debug views (unminified markup) and use a Gulp `watch` to minify the markup files into the `Views` folder with one of the Gulp plugins, such as `gulp-minify-html`; thereafter, the Razor parser can go to work on the minified views. This works as long as no Razor directives are present.\r\n\r\nRazor directives must be on separate lines at the top of `.cshtml` views. Of course, Gulp plugins do not take this into account. Gulp will minify any Razor directives along with the rest of the markup (i.e., remove the line feed character from each directive), thus breaking the Razor parser.\r\n\r\nThere is an ugly workaround: You can use a plugin like `gulp-inject-string` to inject your directives into the tops of the minified markup files after minification ... :-1:\r\n```\r\nvar gulp = require('gulp'),\r\n    minifyHTML = require('gulp-minify-html'),\r\n    inject = require('gulp-inject-string');\r\ngulp.task('processContactView', function () {\r\n    gulp.src('Views_debug/Contact/*.cshtml')\r\n        .pipe(minifyHTML({ quotes: true }))\r\n        .pipe(inject.prepend('@model wpuc.Models.Visitor\\n@addTagHelper \"*, Microsoft.AspNet.Mvc.TagHelpers\"\\n'))\r\n        .pipe(gulp.dest('Views/Contact'));\r\n});\r\n```\r\nI'd like to propose that an optional line termination character be used with the Razor directives parser. If it were developed as an additional option to the line feed, it would not result in a breaking change. The semicolon is a reasonable choice. Such an upgrade would allow the Razor parser to work with minified Razor directives, thus allow you to use a task runner for HTML minification without issue.\r\n\r\nRelated Issues:\r\n[Building Razor views in release mode should minify HTML](https://github.com/aspnet/Razor/issues/423)\r\n[gulpfile.js in File-New Project template needs to be improved](https://github.com/aspnet/Home/issues/628)\r\n[Discussion: Directives inside CodeBlocks](https://github.com/aspnet/Razor/issues/61#issuecomment-116785326)\r\n[what about bundling and minification?](https://github.com/aspnet/dnx/issues/238)\r\n[What about bundling and minification?](https://github.com/aspnet/Home/issues/45)\r\n[What about Bundling and Minification](https://github.com/aspnet/Home/issues/134)\r\n[Bundling and Minification workflow](https://github.com/aspnet/Home/issues/156)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Razor/issues/comments/163536634","html_url":"https://github.com/aspnet/Razor/issues/444#issuecomment-163536634","issue_url":"https://api.github.com/repos/aspnet/Razor/issues/444","id":163536634,"user":{"login":"Anderman","id":1858745,"avatar_url":"https://avatars.githubusercontent.com/u/1858745?v=3","gravatar_id":"","url":"https://api.github.com/users/Anderman","html_url":"https://github.com/Anderman","followers_url":"https://api.github.com/users/Anderman/followers","following_url":"https://api.github.com/users/Anderman/following{/other_user}","gists_url":"https://api.github.com/users/Anderman/gists{/gist_id}","starred_url":"https://api.github.com/users/Anderman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anderman/subscriptions","organizations_url":"https://api.github.com/users/Anderman/orgs","repos_url":"https://api.github.com/users/Anderman/repos","events_url":"https://api.github.com/users/Anderman/events{/privacy}","received_events_url":"https://api.github.com/users/Anderman/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T08:53:57Z","updated_at":"2015-12-10T08:53:57Z","body":"@GuardRex  Cool!"}}