diff --git a/templates/WebApplicationBasic/.babelrc b/templates/WebApplicationBasic/.babelrc new file mode 100644 index 0000000..c13c5f6 --- /dev/null +++ b/templates/WebApplicationBasic/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/templates/WebApplicationBasic/.bowerrc b/templates/WebApplicationBasic/.bowerrc deleted file mode 100755 index 78d4e9d..0000000 --- a/templates/WebApplicationBasic/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "wwwroot/lib" -} diff --git a/templates/WebApplicationBasic/.gitignore b/templates/WebApplicationBasic/.gitignore index 0ca27f0..342cf93 100644 --- a/templates/WebApplicationBasic/.gitignore +++ b/templates/WebApplicationBasic/.gitignore @@ -24,8 +24,7 @@ bld/ # Visual Studio 2015 cache/options directory .vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ +/wwwroot/dist/ # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/templates/WebApplicationBasic/ClientApp/App.ts b/templates/WebApplicationBasic/ClientApp/App.ts new file mode 100644 index 0000000..62cce87 --- /dev/null +++ b/templates/WebApplicationBasic/ClientApp/App.ts @@ -0,0 +1,5 @@ +import 'bootstrap/dist/css/bootstrap.css'; +import './css/site.css'; + +// Replace with your TypeScript code +console.log('Hello, world!'); diff --git a/templates/WebApplicationBasic/wwwroot/css/site.css b/templates/WebApplicationBasic/ClientApp/css/site.css similarity index 100% rename from templates/WebApplicationBasic/wwwroot/css/site.css rename to templates/WebApplicationBasic/ClientApp/css/site.css diff --git a/templates/WebApplicationBasic/Views/Home/Index.cshtml b/templates/WebApplicationBasic/Views/Home/Index.cshtml index 7528409..3715261 100755 --- a/templates/WebApplicationBasic/Views/Home/Index.cshtml +++ b/templates/WebApplicationBasic/Views/Home/Index.cshtml @@ -108,3 +108,7 @@ + +@section scripts { + +} diff --git a/templates/WebApplicationBasic/Views/Shared/_Layout.cshtml b/templates/WebApplicationBasic/Views/Shared/_Layout.cshtml index 7b51d44..39d0e3f 100755 --- a/templates/WebApplicationBasic/Views/Shared/_Layout.cshtml +++ b/templates/WebApplicationBasic/Views/Shared/_Layout.cshtml @@ -5,15 +5,8 @@ @ViewData["Title"] - WebApplicationBasic - - - - - - + @@ -45,23 +38,7 @@ - - - - - - - - - - - + @RenderSection("scripts", required: false) diff --git a/templates/WebApplicationBasic/bower.json b/templates/WebApplicationBasic/bower.json deleted file mode 100755 index 329a18e..0000000 --- a/templates/WebApplicationBasic/bower.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "WebApplicationBasic", - "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/templates/WebApplicationBasic/gulpfile.js b/templates/WebApplicationBasic/gulpfile.js deleted file mode 100755 index a62a0d5..0000000 --- a/templates/WebApplicationBasic/gulpfile.js +++ /dev/null @@ -1,47 +0,0 @@ -/// -"use strict"; - -var gulp = require("gulp"), - rimraf = require("rimraf"), - concat = require("gulp-concat"), - cssmin = require("gulp-cssmin"), - uglify = require("gulp-uglify"); - -var webroot = "./wwwroot/"; - -var paths = { - js: webroot + "js/**/*.js", - minJs: webroot + "js/**/*.min.js", - css: webroot + "css/**/*.css", - minCss: webroot + "css/**/*.min.css", - concatJsDest: webroot + "js/site.min.js", - concatCssDest: 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/templates/WebApplicationBasic/package.json b/templates/WebApplicationBasic/package.json old mode 100755 new mode 100644 index a2ebd7c..1d7c921 --- a/templates/WebApplicationBasic/package.json +++ b/templates/WebApplicationBasic/package.json @@ -1,11 +1,22 @@ -{ - "name": "WebApplicationBasic", - "version": "0.0.0", - "devDependencies": { - "gulp": "^3.9.0", - "gulp-concat": "2.5.2", - "gulp-cssmin": "0.1.7", - "gulp-uglify": "1.2.0", - "rimraf": "2.2.8" - } -} +{ + "name": "WebApplicationBasic", + "version": "0.0.0", + "devDependencies": { + "babel-loader": "^6.2.3", + "babel-preset-es2015": "^6.5.0", + "bootstrap": "^3.3.6", + "css-loader": "^0.23.1", + "extendify": "^1.0.0", + "extract-text-webpack-plugin": "^1.0.1", + "file-loader": "^0.8.5", + "jquery": "^2.2.1", + "style-loader": "^0.13.0", + "ts-loader": "^0.8.1", + "typescript": "^1.8.2", + "url-loader": "^0.5.7", + "webpack": "^1.12.14" + }, + "dependencies": { + "babel-core": "^6.5.2" + } +} diff --git a/templates/WebApplicationBasic/project.json b/templates/WebApplicationBasic/project.json index d08af99..6633154 100755 --- a/templates/WebApplicationBasic/project.json +++ b/templates/WebApplicationBasic/project.json @@ -34,11 +34,9 @@ "exclude": [ "wwwroot", "node_modules", - "bower_components" ], "publishExclude": [ "node_modules", - "bower_components", "**.xproj", "**.user", "**.vspscc" @@ -46,9 +44,7 @@ "scripts": { "prepublish": [ "npm install", - "bower install", - "gulp clean", - "gulp min" + "webpack" ] } } diff --git a/templates/WebApplicationBasic/tsconfig.json b/templates/WebApplicationBasic/tsconfig.json new file mode 100644 index 0000000..4340e17 --- /dev/null +++ b/templates/WebApplicationBasic/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "target": "es6", + "sourceMap": true + }, + "exclude": [ + "node_modules" + ] +} diff --git a/templates/WebApplicationBasic/webpack.config.dev.js b/templates/WebApplicationBasic/webpack.config.dev.js new file mode 100644 index 0000000..fd41ce6 --- /dev/null +++ b/templates/WebApplicationBasic/webpack.config.dev.js @@ -0,0 +1,8 @@ +module.exports = { + devtool: 'inline-source-map', + module: { + loaders: [ + { test: /\.css/, loader: 'style!css' } + ] + } +}; diff --git a/templates/WebApplicationBasic/webpack.config.js b/templates/WebApplicationBasic/webpack.config.js new file mode 100644 index 0000000..3db3efe --- /dev/null +++ b/templates/WebApplicationBasic/webpack.config.js @@ -0,0 +1,33 @@ +var path = require('path'); +var webpack = require('webpack'); +var merge = require('extendify')({ isDeep: true, arrays: 'concat' }); +var devConfig = require('./webpack.config.dev'); +var prodConfig = require('./webpack.config.prod'); +var isDevelopment = process.env.ASPNET_ENV === 'Development'; + +module.exports = merge({ + resolve: { + extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ] + }, + module: { + loaders: [ + { test: /\.ts(x?)$/, include: /ClientApp/, loader: 'babel-loader' }, + { test: /\.ts(x?)$/, include: /ClientApp/, loader: 'ts-loader' }, + { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' } + ] + }, + entry: { + main: ['./ClientApp/App.ts'], + vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'style-loader', 'jquery'] + }, + output: { + path: path.join(__dirname, 'wwwroot', 'dist'), + filename: '[name].js', + publicPath: '/dist/' + }, + plugins: [ + new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable) + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js') // Moves vendor content out of other bundles + ] +}, isDevelopment ? devConfig : prodConfig); diff --git a/templates/WebApplicationBasic/webpack.config.prod.js b/templates/WebApplicationBasic/webpack.config.prod.js new file mode 100644 index 0000000..302dd3c --- /dev/null +++ b/templates/WebApplicationBasic/webpack.config.prod.js @@ -0,0 +1,15 @@ +var webpack = require('webpack'); +var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var extractCSS = new ExtractTextPlugin('site.css'); + +module.exports = { + module: { + loaders: [ + { test: /\.css/, loader: extractCSS.extract(['css']) }, + ] + }, + plugins: [ + extractCSS, + new webpack.optimize.UglifyJsPlugin({ minimize: true }) + ] +}; diff --git a/templates/WebApplicationBasic/wwwroot/css/site.min.css b/templates/WebApplicationBasic/wwwroot/css/site.min.css deleted file mode 100644 index 1547cbc..0000000 --- a/templates/WebApplicationBasic/wwwroot/css/site.min.css +++ /dev/null @@ -1 +0,0 @@ -body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4} diff --git a/templates/WebApplicationBasic/wwwroot/js/site.js b/templates/WebApplicationBasic/wwwroot/js/site.js deleted file mode 100755 index e069226..0000000 --- a/templates/WebApplicationBasic/wwwroot/js/site.js +++ /dev/null @@ -1 +0,0 @@ -// Write your Javascript code. diff --git a/templates/WebApplicationBasic/wwwroot/js/site.min.js b/templates/WebApplicationBasic/wwwroot/js/site.min.js deleted file mode 100644 index e69de29..0000000