Skip to content

Commit

Permalink
Change minification process
Browse files Browse the repository at this point in the history
  • Loading branch information
jamen committed Dec 7, 2015
1 parent baaa0e2 commit 939ed5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
7 changes: 4 additions & 3 deletions fake-app.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"port": 80,
"app": "dist/app.min.html",
"port": 8080,
"host": "127.0.0.1",
"app": "dist/app.html",
"scripts": null,
"styles": null,
"static": {
"url": "/dist",
"dir": "dist",
"options": {
"maxAge": "24h"
"maxAge": "0"
}
}
}
15 changes: 6 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,18 @@ gulp.task('build:swig', () =>
// Minification
gulp.task('minify:javascript', [ 'build:javascript' ], () =>
gulp.src('dist/app.js')
.pipe(rename('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'))
);

gulp.task('minify:css', [ 'build:stylus' ], () =>
gulp.src('dist/app.css')
.pipe(rename('app.min.css'))
.pipe(minCSS())
.pipe(gulp.dest('dist'))
);

gulp.task('minify:html', [ 'build:swig' ], () =>
gulp.src('dist/app.html')
.pipe(rename('app.min.html'))
.pipe(minHTML())
.pipe(gulp.dest('dist'))
);
Expand All @@ -88,15 +85,15 @@ gulp.task('minify', [
]);

// Alias for build & minify
gulp.task('default', [ 'minify' ]);
gulp.task('default', [ 'build' ]);

// Watch
gulp.task('watch', [ 'minify' ], function(){
gulp.watch('views/**', [ 'build:swig', 'minify:html' ]);
gulp.watch('styles/**', [ 'build:stylus', 'minify:css' ]);
gulp.watch('scripts/**', [ 'build:javascript', 'minify:javascript' ]);
gulp.task('watch', [ 'build' ], function(){
gulp.watch('views/**', [ 'build:swig' ]);
gulp.watch('styles/**', [ 'build:stylus' ]);
gulp.watch('scripts/**', [ 'build:javascript' ]);

// Create fake app-server:
fake([ '-c', 'app.json', '--port=8080', '--static.maxAge="0"' ]);
fake([ '-c', 'fake-app.json' ]);
require('app-server');
});
2 changes: 1 addition & 1 deletion scripts/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import app from './test';
import 'jquery';
import $ from 'jquery';

$(function(){
console.log(app);
Expand Down
4 changes: 2 additions & 2 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<title>SoundCove</title>
<script src='/static/app.min.js'></script>
<link href='/static/app.min.css' rel='stylesheet' type='text/css'>
<script src='/dist/app.js'></script>
<link href='/dist/app.css' rel='stylesheet' type='text/css'>
</head>
<body class='temp-master -fill -nopad -flex'>
<div class='soon'>SoundCove comming soon.</div>
Expand Down

0 comments on commit 939ed5a

Please sign in to comment.