From 04e009d27da0384026b00cbff5ccd494da56c245 Mon Sep 17 00:00:00 2001 From: markehost Date: Thu, 28 Aug 2014 09:09:45 -0400 Subject: [PATCH 1/2] added gulp plugins, adjusted gulpfile.js structure - still not targeting correct files --- app/css/app.css | 2 -- gulpfile.js | 40 ++++++++++++++++++++++++++++++++++++++++ package.json | 24 +++++++++++++++--------- 3 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 gulpfile.js diff --git a/app/css/app.css b/app/css/app.css index 1e541bb..c925240 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -28,5 +28,3 @@ content: ""; padding: 0; } - -/* test here */ \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..eccd32c --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,40 @@ +var gulp = require('gulp'), + plugins = require("gulp-load-plugins")({ + pattern: ['gulp-*', 'gulp.*'], + replaceString: /\bgulp[\-.]/ + }), + del = require('del'); + + +var paths = { + scripts: ['client/js/**/*.coffee', '!client/external/**/*.coffee'], + images: 'client/img/**/*' +}; + + +gulp.task('clean', function(cb) { + del(['build'], cb); +}); + +gulp.task('scripts', ['clean'], function() { + return gulp.src(paths.scripts) + .pipe(plugins.sourcemaps.init()) + .pipe(plugins.uglify()) + .pipe(plugins.concat('all.min.js')) + .pipe(plugins.sourcemaps.write()) + .pipe(gulp.dest('build/js')); +}); + +gulp.task('images', ['clean'], function() { + return gulp.src(paths.images) + .pipe(plugins.imagemin({optimizationLevel: 5})) + .pipe(gulp.dest('build/img')); +}); + + +gulp.task('watch', function() { + gulp.watch(paths.scripts, ['scripts']); + gulp.watch(paths.images, ['images']); +}); + +gulp.task('default', ['watch', 'scripts', 'images']); \ No newline at end of file diff --git a/package.json b/package.json index 5035daf..332222b 100644 --- a/package.json +++ b/package.json @@ -6,29 +6,35 @@ "repository": "https://github.com/angular/angular-seed", "license": "MIT", "devDependencies": { + "bower": "^1.3.1", + "del": "^0.1.2", + "gulp": "^3.8.7", + "gulp-concat": "^2.3.4", + "gulp-csslint": "^0.1.5", + "gulp-csso": "^0.2.9", + "gulp-imagemin": "^1.0.1", + "gulp-jshint": "^1.8.4", + "gulp-load-plugins": "^0.6.0", + "gulp-rename": "^1.2.0", + "gulp-sourcemaps": "^1.1.3", + "gulp-uglify": "^0.3.2", + "http-server": "^0.6.1", "karma": "~0.10", + "karma-junit-reporter": "^0.2.2", "protractor": "~0.20.1", - "http-server": "^0.6.1", - "bower": "^1.3.1", - "shelljs": "^0.2.6", - "karma-junit-reporter": "^0.2.2" + "shelljs": "^0.2.6" }, "scripts": { "postinstall": "bower install", - "prestart": "npm install", "start": "http-server -a localhost -p 8000", - "pretest": "npm install", "test": "karma start test/karma.conf.js", "test-single-run": "karma start test/karma.conf.js --single-run", - "preupdate-webdriver": "npm install", "update-webdriver": "webdriver-manager update", - "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", - "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\"" } } From 9d3f05f5b35e9813911f47bafc6adab4df85cc13 Mon Sep 17 00:00:00 2001 From: markehost Date: Thu, 28 Aug 2014 09:09:45 -0400 Subject: [PATCH 2/2] added gulp plugins, adjusted gulpfile.js structure - still not targeting correct files (cherry picked from commit 04e009d) --- app/css/app.css | 1 + gulpfile.js | 3 ++- package.json | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/css/app.css b/app/css/app.css index c925240..4783fe8 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -28,3 +28,4 @@ content: ""; padding: 0; } + diff --git a/gulpfile.js b/gulpfile.js index eccd32c..ea0d63d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -37,4 +37,5 @@ gulp.task('watch', function() { gulp.watch(paths.images, ['images']); }); -gulp.task('default', ['watch', 'scripts', 'images']); \ No newline at end of file +gulp.task('default', ['watch', 'scripts', 'images']); + diff --git a/package.json b/package.json index 332222b..ba86489 100644 --- a/package.json +++ b/package.json @@ -38,3 +38,5 @@ "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\"" } } + +