diff --git a/app/templates/_package.json b/app/templates/_package.json index b57bd64..1ee1e1b 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -11,26 +11,21 @@ "gulp": "^3.8.10", "gulp-angular-filesort": "^1.0.4", "gulp-autoprefixer": "^1.0.1", - "gulp-flatten": "^0.0.4", - "gulp-if": "^1.2.5", "gulp-inject": "^1.1.1", "gulp-jscs": "^1.4.0", "gulp-jshint": "^1.9.0", "gulp-livereload": "^3.2.0", "gulp-load-plugins": "^0.8.0", - "gulp-ng-annotate": "^0.4.3", "gulp-plumber": "^0.6.6", "gulp-ruby-sass": "^0.7.1", "gulp-shell": "^0.2.11", "gulp-size": "^1.2.0", - "gulp-uglify": "^1.0.2", "gulp-useref": "^1.1.1", "jshint-stylish": "^1.0.0", "main-bower-files": "^2.4.1", "minimist": "^1.1.0", "opn": "^1.0.1", "require-dir": "^0.1.0", - "serve-index": "^1.6.0", "serve-static": "^1.8.0", "vinyl-paths": "^1.0.0", "wiredep": "^2.2.2", diff --git a/app/templates/gulp_tasks/building.js b/app/templates/gulp_tasks/building.js index 1f55ead..cef3cc8 100644 --- a/app/templates/gulp_tasks/building.js +++ b/app/templates/gulp_tasks/building.js @@ -19,29 +19,19 @@ gulp.task('clean', function () { return gulp.src(['.tmp', paths.dist + '/*']) .pipe(vinylPaths(del)); }); + // concatenate files in build:blocks inside index.html // and copy to build folder destinations gulp.task('build-app', ['clean', 'inject-all'], function () { - // useref - parses build block in html, concatenate & replace files - // only builds files that are actually used var assets = $.useref.assets({searchPath: '{.tmp,app}'}); return gulp.src('app/index.html') // main html file .pipe(assets) - // TODO: implement flag to turn on - // .pipe($.if('*.js', // angular DI & uglification - // $.ngAnnotate({ - // remove: true, - // add: true, - // 'single_quotes': true - // }) - // .pipe($.uglify()) - // )) - // .pipe($.if('*.css', $.csso())) // minify css .pipe(assets.restore()) .pipe($.useref()) .pipe(gulp.dest(paths.dist)); }); + // copy templates gulp.task('build-templates', ['clean'], function () { return gulp.src([ @@ -49,13 +39,9 @@ gulp.task('build-templates', ['clean'], function () { ]) .pipe(gulp.dest(paths.dist)); }); + // copy assets, wait for fonts gulp.task('build-assets', ['clean', 'bower-fonts'], function () { return gulp.src('app/**/assets/**/*') - // disabled: imagemin not working correctly - https://github.com/mwaylabs/generator-m/issues/90 - // .pipe($.cache($.imagemin({ - // progressive: true, - // interlaced: true - // }))) .pipe(gulp.dest(paths.dist)); }); diff --git a/app/templates/gulp_tasks/configuring.js b/app/templates/gulp_tasks/configuring.js index dea31f1..6abf3e3 100644 --- a/app/templates/gulp_tasks/configuring.js +++ b/app/templates/gulp_tasks/configuring.js @@ -19,9 +19,10 @@ gulp.task('config', function () { encoding: 'utf-8' } }); + // read & parse file var xmlFile = fs.readFileSync(__dirname + '/config.xml'); parser.parseString(xmlFile, function (err, result) { - // actual processing + // update values if (options.setVersion) { result.widget.$.version = options.setVersion; } @@ -31,7 +32,7 @@ gulp.task('config', function () { if (options.setBundle) { result.widget.$.id = options.setBundle; } - + // write file var xml = builder.buildObject(result); fs.writeFileSync(__dirname + '/config.xml', xml); }); diff --git a/app/templates/gulp_tasks/injecting.js b/app/templates/gulp_tasks/injecting.js index 5d6f8bc..54f30f9 100644 --- a/app/templates/gulp_tasks/injecting.js +++ b/app/templates/gulp_tasks/injecting.js @@ -45,10 +45,6 @@ gulp.task('styles', function () { // inject bower components gulp.task('wiredep', function () { -// TODO: -// gulp.src('app/styles/*.scss') // into main.scss -// .pipe(wiredep()) -// .pipe(gulp.dest('app/styles')); return gulp.src('app/index.html') // into index.html .pipe(wiredep.stream({exclude: ['bower_components/ionic/release/css']})) // exclude ionic scss since we're using ionic sass @@ -60,6 +56,5 @@ gulp.task('bower-fonts', function () { var fontFiles = mainBowerFiles({filter: /\.(eot|svg|ttf|woff)/i}) .concat('app/main/assets/fonts/**/*'); return gulp.src(fontFiles) - .pipe($.flatten()) .pipe(gulp.dest('app/main/assets/fonts')); // TODO: find a better way to inject $ionicons-font-path: "../fonts" !default; into main.scss on build }); diff --git a/app/templates/gulp_tasks/watching.js b/app/templates/gulp_tasks/watching.js index 8102397..34e9799 100644 --- a/app/templates/gulp_tasks/watching.js +++ b/app/templates/gulp_tasks/watching.js @@ -30,7 +30,6 @@ var createConnectServer = function (paths) { gulp.task('watch', ['serve'], function () { $.livereload.listen(); - // watch for changes gulp.watch([ 'app/index.html', '.tmp/*/styles/main.css', // each module's main.css