Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
fixes #35 - reviewed gulp tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Grupp committed Feb 4, 2015
1 parent 4a593b3 commit 2169046
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 30 deletions.
5 changes: 0 additions & 5 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 3 additions & 17 deletions app/templates/gulp_tasks/building.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,29 @@ 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([
'app/**/templates/**/*',
])
.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));
});
5 changes: 3 additions & 2 deletions app/templates/gulp_tasks/configuring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
});
Expand Down
5 changes: 0 additions & 5 deletions app/templates/gulp_tasks/injecting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
});
1 change: 0 additions & 1 deletion app/templates/gulp_tasks/watching.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2169046

Please sign in to comment.