Skip to content

Commit

Permalink
Merge pull request #205 from bullhorn/revert-159-f/minify-fix
Browse files Browse the repository at this point in the history
Revert "chore(build): Fixing minification"
  • Loading branch information
charlesabarnes committed Jun 15, 2018
2 parents 24f9f3e + d5f2074 commit 225b87f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 50 deletions.
60 changes: 16 additions & 44 deletions build/build.js
Expand Up @@ -3,7 +3,6 @@
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var pump = require('pump');

var $ = require('gulp-load-plugins')({
pattern: [
Expand All @@ -15,7 +14,6 @@ var $ = require('gulp-load-plugins')({
'main-bower-files',
'uglify-save-license',
'gulp-uglify',
'gulp-cssnano',
'del',
'gulp-size',
'gulp-useref',
Expand All @@ -26,9 +24,9 @@ var $ = require('gulp-load-plugins')({

gulp.task('partials', function () {
return gulp.src([
path.join(conf.paths.src, '/app/**/*.html'),
path.join(conf.paths.tmp, '/serve/app/**/*.html')
])
path.join(conf.paths.src, '/app/**/*.html'),
path.join(conf.paths.tmp, '/serve/app/**/*.html')
])
.pipe($.minifyHtml({
empty: true,
spare: true,
Expand All @@ -44,31 +42,24 @@ gulp.task('partials', function () {
var wiredep = require('wiredep').stream;

gulp.task('html', ['inject', 'partials'], function () {
var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), {
read: false
});
var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), {read: false});
var partialsInjectOptions = {
starttag: '<!-- inject:partials -->',
ignorePath: path.join(conf.paths.tmp, '/partials'),
addRootSlash: false
};

var htmlFilter = $.filter('*.html', {
restore: true
});
var jsFilter = $.filter('**/*.js', {
restore: true
});
var cssFilter = $.filter('**/*.css', {
restore: true
});
var htmlFilter = $.filter('*.html', { restore: true });
var jsFilter = $.filter('**/*.js', { restore: true });
var cssFilter = $.filter('**/*.css', { restore: true });
// var assets;

return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))
.pipe($.inject(partialsInjectFile, partialsInjectOptions))
.pipe($.useref({
searchPath: ['.src']
}))
.pipe($.useref({ searchPath: ['.src'] }))
.pipe(jsFilter)
.pipe($.uglify())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe($.cleanCss({cache: true}))
.pipe(cssFilter.restore)
Expand All @@ -81,10 +72,7 @@ gulp.task('html', ['inject', 'partials'], function () {
}))
.pipe(htmlFilter.restore)
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
.pipe($.size({
title: path.join(conf.paths.dist, '/'),
showFiles: true
}));
.pipe($.size({title: path.join(conf.paths.dist, '/'), showFiles: true}));
});

// Only applies for fonts from bower dependencies
Expand All @@ -108,10 +96,10 @@ gulp.task('other', ['config:app'], function () {
});

return gulp.src([
path.join(conf.paths.src, '/**/*'),
path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss,template}'),
path.join('!' + conf.paths.src, '/web.config')
])
path.join(conf.paths.src, '/**/*'),
path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss,template}'),
path.join('!' + conf.paths.src, '/web.config')
])
.pipe(fileFilter)
.pipe(gulp.dest(path.join(conf.paths.dist, '/')));
});
Expand All @@ -120,20 +108,4 @@ gulp.task('clean', function () {
$.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/'), conf.paths.zip]);
});

gulp.task('uglify', function (cb) {
pump([
gulp.src('dist/scripts/*.js'),
$.uglify(),
gulp.dest('dist/scripts')
], cb);
});

gulp.task('minify', function (cb) {
pump([
gulp.src('dist/styles/*.css'),
$.cssnano(),
gulp.dest('dist/styles')
], cb);
});

gulp.task('build', ['html', 'fonts', 'other']);
8 changes: 4 additions & 4 deletions gulpfile.js
Expand Up @@ -26,16 +26,16 @@ klawSync('./build')
* Default task clean temporaries directories and launch the
* main optimization build task
*/
gulp.task('default', ['clean'], function (done) {
runSequence('build', 'uglify', 'minify', done);
gulp.task('default', ['clean'], function () {
gulp.start('build');
});

gulp.task('jenkins:build', function (done) {
runSequence('clean', 'test', 'build', 'uglify', 'minify', 'version', 'report:plato', done);
runSequence('clean', 'test', 'build', 'version', 'report:plato', done);
});

gulp.task('travis:build', function (done) {
runSequence('clean', 'test', 'build', 'uglify', 'minify', done);
runSequence('clean', 'test', 'build', done);
});

gulp.task('config:app', function () {
Expand Down
2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -22,7 +22,6 @@
"gulp-angular-templatecache": "~2.0.0",
"gulp-autoprefixer": "~4.0.0",
"gulp-babel": "^6.1.2",
"gulp-cssnano": "^2.1.2",
"gulp-clean-css": "^3.7.0",
"gulp-eslint": "~4.0.0",
"gulp-filter": "~5.0.0",
Expand Down Expand Up @@ -56,7 +55,6 @@
"ng-annotate-loader": "0.6.1",
"phantomjs-prebuilt": "^2.1.14",
"plato": "^1.7.0",
"pump": "^1.0.2",
"run-sequence": "^2.1.0",
"sloc": "^0.2.0",
"uglify-save-license": "~0.4.1",
Expand Down

0 comments on commit 225b87f

Please sign in to comment.