Skip to content

Commit

Permalink
compress and add license
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizeta committed Apr 2, 2016
1 parent 3b7fc05 commit bb7fbc4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
7 changes: 7 additions & 0 deletions dist/Mason.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Mason
* https://github.com/Five-African/Mason
*
* Copyright 2016 Five-African
* Released under the Apache License 2.0
*/
(function(global) {
function Environment(parent) {
this.vars = Object.create(parent ? parent.vars : null);
Expand Down
8 changes: 8 additions & 0 deletions dist/Mason.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
var gulp = require('gulp');
var concat = require('gulp-concat');
var del = require('del');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var header = require('gulp-header');

var license = ['/**',
' * Mason',
' * https://github.com/Five-African/Mason',
' * ',
' * Copyright 2016 Five-African',
' * Released under the Apache License 2.0',
' */',
''].join('\n');

gulp.task('clean', function() {
return del(['dist/**/*']);
Expand All @@ -9,7 +21,16 @@ gulp.task('clean', function() {
gulp.task('concat', function() {
return gulp.src('src/*.js')
.pipe(concat('Mason.js'))
.pipe(header(license))
.pipe(gulp.dest('dist/'));
});

gulp.task('uglify', function() {
return gulp.src('dist/Mason.js')
.pipe(uglify({}))
.pipe(header(license))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('dist/'));
});

gulp.task('default', ['clean', 'concat']);
gulp.task('default', ['clean', 'concat', 'uglify']);
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"dependencies": {
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0"
"gulp-concat": "^2.6.0",
"gulp-header": "^1.7.1",
"gulp-rename": "^1.2.2"
},
"devDependencies": {
"gulp-uglify": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<textarea id="code"></textarea>
<textarea id="result"></textarea><br/>
<button id="eval">eval</button>
<script src="../dist/Mason.js"></script>
<script src="../dist/Mason.min.js"></script>
<script>
document.getElementById("eval").onclick = function() {
var code = document.getElementById("code").value;
Expand Down

0 comments on commit bb7fbc4

Please sign in to comment.