From fb07fee4654271dd55a513536f7e2e86c93207c2 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 17 Mar 2016 13:40:20 -0700 Subject: [PATCH] Reduce grunt work in Mvc --- .gitignore | 1 - .../MvcSandbox/Views/Shared/_Layout.cshtml | 30 ++----------- samples/MvcSandbox/bower.json | 10 ----- samples/MvcSandbox/gulpfile.js | 45 ------------------- samples/MvcSandbox/package.json | 5 --- samples/MvcSandbox/wwwroot/_references.js | 7 --- samples/MvcSandbox/wwwroot/css/site.css | 34 -------------- samples/MvcSandbox/wwwroot/js/site.js | 1 - .../_grunt.readme | 1 + .../{gruntfile.js => _gruntfile.js} | 0 .../{package.json => _package.json} | 0 .../LinkTagHelper_FallbackJavaScript.js | 1 + test/WebSites/BasicWebSite/bower.json | 21 --------- test/WebSites/BasicWebSite/gruntfile.js | 21 --------- test/WebSites/BasicWebSite/package.json | 10 ----- 15 files changed, 5 insertions(+), 182 deletions(-) delete mode 100644 samples/MvcSandbox/bower.json delete mode 100644 samples/MvcSandbox/gulpfile.js delete mode 100644 samples/MvcSandbox/package.json delete mode 100644 samples/MvcSandbox/wwwroot/_references.js delete mode 100644 samples/MvcSandbox/wwwroot/css/site.css delete mode 100644 samples/MvcSandbox/wwwroot/js/site.js create mode 100644 src/Microsoft.AspNetCore.Mvc.TagHelpers/_grunt.readme rename src/Microsoft.AspNetCore.Mvc.TagHelpers/{gruntfile.js => _gruntfile.js} (100%) rename src/Microsoft.AspNetCore.Mvc.TagHelpers/{package.json => _package.json} (100%) create mode 100644 src/Microsoft.AspNetCore.Mvc.TagHelpers/compiler/resources/LinkTagHelper_FallbackJavaScript.js delete mode 100644 test/WebSites/BasicWebSite/bower.json delete mode 100644 test/WebSites/BasicWebSite/gruntfile.js delete mode 100644 test/WebSites/BasicWebSite/package.json diff --git a/.gitignore b/.gitignore index ca84ed657..9f3c608a0 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,4 @@ nuget.exe .settings *.sln.ide node_modules -**/[Cc]ompiler/[Rr]esources/**/*.js *launchSettings.json \ No newline at end of file diff --git a/samples/MvcSandbox/Views/Shared/_Layout.cshtml b/samples/MvcSandbox/Views/Shared/_Layout.cshtml index d74abe0fc..7d7619b2b 100644 --- a/samples/MvcSandbox/Views/Shared/_Layout.cshtml +++ b/samples/MvcSandbox/Views/Shared/_Layout.cshtml @@ -4,17 +4,7 @@ @ViewData["Title"] - MvcSandbox - - - - - - - - - + - - - - - - - - - - + + @RenderSection("scripts", required: false) diff --git a/samples/MvcSandbox/bower.json b/samples/MvcSandbox/bower.json deleted file mode 100644 index ac5514cae..000000000 --- a/samples/MvcSandbox/bower.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "ASP.NET", - "private": true, - "dependencies": { - "bootstrap": "3.3.5", - "jquery": "2.1.4", - "jquery-validation": "1.14.0", - "jquery-validation-unobtrusive": "3.2.4" - } -} diff --git a/samples/MvcSandbox/gulpfile.js b/samples/MvcSandbox/gulpfile.js deleted file mode 100644 index f79a1eb4f..000000000 --- a/samples/MvcSandbox/gulpfile.js +++ /dev/null @@ -1,45 +0,0 @@ -/// -"use strict"; - -var gulp = require("gulp"), - rimraf = require("rimraf"), - concat = require("gulp-concat"), - cssmin = require("gulp-cssmin"), - uglify = require("gulp-uglify"); - -var paths = { - webroot: "./wwwroot/" -}; - -paths.js = paths.webroot + "js/**/*.js"; -paths.minJs = paths.webroot + "js/**/*.min.js"; -paths.css = paths.webroot + "css/**/*.css"; -paths.minCss = paths.webroot + "css/**/*.min.css"; -paths.concatJsDest = paths.webroot + "js/site.min.js"; -paths.concatCssDest = paths.webroot + "css/site.min.css"; - -gulp.task("clean:js", function (cb) { - rimraf(paths.concatJsDest, cb); -}); - -gulp.task("clean:css", function (cb) { - rimraf(paths.concatCssDest, cb); -}); - -gulp.task("clean", ["clean:js", "clean:css"]); - -gulp.task("min:js", function () { - return gulp.src([paths.js, "!" + paths.minJs], { base: "." }) - .pipe(concat(paths.concatJsDest)) - .pipe(uglify()) - .pipe(gulp.dest(".")); -}); - -gulp.task("min:css", function () { - return gulp.src([paths.css, "!" + paths.minCss]) - .pipe(concat(paths.concatCssDest)) - .pipe(cssmin()) - .pipe(gulp.dest(".")); -}); - -gulp.task("min", ["min:js", "min:css"]); diff --git a/samples/MvcSandbox/package.json b/samples/MvcSandbox/package.json deleted file mode 100644 index 73689cf48..000000000 --- a/samples/MvcSandbox/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "ASP.NET", - "private": true, - "version": "0.0.0" -} diff --git a/samples/MvcSandbox/wwwroot/_references.js b/samples/MvcSandbox/wwwroot/_references.js deleted file mode 100644 index 9b2a79166..000000000 --- a/samples/MvcSandbox/wwwroot/_references.js +++ /dev/null @@ -1,7 +0,0 @@ -/// -/// -/// -/// -/// -/// -/// diff --git a/samples/MvcSandbox/wwwroot/css/site.css b/samples/MvcSandbox/wwwroot/css/site.css deleted file mode 100644 index 1eaae3d04..000000000 --- a/samples/MvcSandbox/wwwroot/css/site.css +++ /dev/null @@ -1,34 +0,0 @@ -body { - padding-top: 50px; - padding-bottom: 20px; -} - -/* Wrapping element */ -/* Set some basic padding to keep content from hitting the edges */ -.body-content { - padding-left: 15px; - padding-right: 15px; -} - -/* Set widths on the form inputs since otherwise they're 100% wide */ -input, -select, -textarea { - max-width: 280px; -} - -/* Carousel */ -.carousel-caption { - z-index: 10 !important; -} - - .carousel-caption p { - font-size: 20px; - line-height: 1.4; - } - -@media (min-width: 768px) { - .carousel-caption { - z-index: 10 !important; - } -} diff --git a/samples/MvcSandbox/wwwroot/js/site.js b/samples/MvcSandbox/wwwroot/js/site.js deleted file mode 100644 index 82ecce7b4..000000000 --- a/samples/MvcSandbox/wwwroot/js/site.js +++ /dev/null @@ -1 +0,0 @@ -// Write your Javascript code. diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/_grunt.readme b/src/Microsoft.AspNetCore.Mvc.TagHelpers/_grunt.readme new file mode 100644 index 000000000..ed50eafb6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/_grunt.readme @@ -0,0 +1 @@ +To recreate minified js files, rename _gruntfile.js to gruntfile.js, _package.json to package.json, and run build. \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/gruntfile.js b/src/Microsoft.AspNetCore.Mvc.TagHelpers/_gruntfile.js similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.TagHelpers/gruntfile.js rename to src/Microsoft.AspNetCore.Mvc.TagHelpers/_gruntfile.js diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/package.json b/src/Microsoft.AspNetCore.Mvc.TagHelpers/_package.json similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.TagHelpers/package.json rename to src/Microsoft.AspNetCore.Mvc.TagHelpers/_package.json diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/compiler/resources/LinkTagHelper_FallbackJavaScript.js b/src/Microsoft.AspNetCore.Mvc.TagHelpers/compiler/resources/LinkTagHelper_FallbackJavaScript.js new file mode 100644 index 000000000..8663692cf --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/compiler/resources/LinkTagHelper_FallbackJavaScript.js @@ -0,0 +1 @@ +!function(a,b,c){var d,e=document,f=e.getElementsByTagName("SCRIPT"),g=f[f.length-1].previousElementSibling,h=e.defaultView&&e.defaultView.getComputedStyle?e.defaultView.getComputedStyle(g):g.currentStyle;if(h&&h[a]!==b)for(d=0;d')}(); \ No newline at end of file diff --git a/test/WebSites/BasicWebSite/bower.json b/test/WebSites/BasicWebSite/bower.json deleted file mode 100644 index 2a56f08d2..000000000 --- a/test/WebSites/BasicWebSite/bower.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "BasicWebSite", - "description": "Web site demonstrating various validations.", - "private": true, - "dependencies": { - "jquery": "1.11.2", - "jquery-validation": "1.13.1", - "jquery-validation-unobtrusive": "3.2.2" - }, - "exportsOverride": { - "jquery": { - "": "dist/jquery.{js,min.js,min.map}" - }, - "jquery-validation": { - "": "dist/jquery.validate.{js,min.js}" - }, - "jquery-validation-unobtrusive": { - "": "jquery.validate.unobtrusive.{js,min.js}" - } - } -} diff --git a/test/WebSites/BasicWebSite/gruntfile.js b/test/WebSites/BasicWebSite/gruntfile.js deleted file mode 100644 index 34c745b14..000000000 --- a/test/WebSites/BasicWebSite/gruntfile.js +++ /dev/null @@ -1,21 +0,0 @@ - -module.exports = function (grunt) { - grunt.initConfig({ - bower: { - install: { - options: { - targetDir: "wwwroot/lib", - layout: "byComponent", - cleanTargetDir: false - } - } - } - }); - - // This command registers the default task which will install bower packages into wwwroot/lib - grunt.registerTask("default", ["bower:install"]); - - // The following line loads the grunt plugins. - // This line needs to be at the end of this this file. - grunt.loadNpmTasks("grunt-bower-task"); -}; \ No newline at end of file diff --git a/test/WebSites/BasicWebSite/package.json b/test/WebSites/BasicWebSite/package.json deleted file mode 100644 index a0d2a37b7..000000000 --- a/test/WebSites/BasicWebSite/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": "0.0.0", - "name": "BasicWebSite", - "description": "Web site demonstrating various validations.", - "private": true, - "devDependencies": { - "grunt": "^0.4.5", - "grunt-bower-task": "^0.4.0" - } -} \ No newline at end of file