-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
compiled | ||
vendor | ||
/avim.zip | ||
build | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
'use strict'; | ||
|
||
//npm install gulp gulp-minify-css gulp-uglify gulp-clean gulp-cleanhtml gulp-jshint gulp-strip-debug gulp-zip --save-dev | ||
|
||
var gulp = require('gulp'), | ||
clean = require('gulp-clean'), | ||
cleanhtml = require('gulp-cleanhtml'), | ||
minifycss = require('gulp-minify-css'), | ||
jshint = require('gulp-jshint'), | ||
stripdebug = require('gulp-strip-debug'), | ||
uglify = require('gulp-uglify'), | ||
zip = require('gulp-zip'); | ||
|
||
//clean build directory | ||
gulp.task('clean', function() { | ||
return gulp.src('build/*', {read: false}) | ||
.pipe(clean()); | ||
}); | ||
|
||
//copy static folders to build directory | ||
gulp.task('copy', function() { | ||
gulp.src('src/fonts/**') | ||
.pipe(gulp.dest('build/fonts')); | ||
gulp.src('src/icons/**') | ||
.pipe(gulp.dest('build/icons')); | ||
gulp.src('src/_locales/**') | ||
.pipe(gulp.dest('build/_locales')); | ||
return gulp.src('src/manifest.json') | ||
.pipe(gulp.dest('build')); | ||
}); | ||
|
||
//copy and compress HTML files | ||
gulp.task('html', function() { | ||
return gulp.src('src/*.html') | ||
.pipe(cleanhtml()) | ||
.pipe(gulp.dest('build')); | ||
}); | ||
|
||
//run scripts through JSHint | ||
gulp.task('jshint', function() { | ||
return gulp.src('src/scripts/*.js') | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter('default')); | ||
}); | ||
|
||
//copy vendor scripts and uglify all other scripts, creating source maps | ||
gulp.task('scripts', ['jshint'], function() { | ||
gulp.src('src/scripts/vendors/**/*.js') | ||
.pipe(gulp.dest('build/scripts/vendors')); | ||
return gulp.src(['src/scripts/**/*.js', '!src/scripts/vendors/**/*.js']) | ||
.pipe(stripdebug()) | ||
.pipe(uglify({outSourceMap: true})) | ||
.pipe(gulp.dest('build/scripts')); | ||
}); | ||
|
||
//minify styles | ||
gulp.task('styles', function() { | ||
// return gulp.src('src/styles/**/*.css') | ||
// .pipe(minifycss({root: 'src/styles', keepSpecialComments: 0})) | ||
// .pipe(gulp.dest('build/styles')); | ||
return gulp.src('src/styles/**') | ||
.pipe(gulp.dest('build/styles')); | ||
}); | ||
|
||
//build ditributable and sourcemaps after other tasks completed | ||
gulp.task('zip', ['html', 'scripts', 'styles', 'copy'], function() { | ||
var manifest = require('./src/manifest'), | ||
distFileName = manifest.name + ' v' + manifest.version + '.zip', | ||
mapFileName = manifest.name + ' v' + manifest.version + '-maps.zip'; | ||
//collect all source maps | ||
gulp.src('build/scripts/**/*.map') | ||
.pipe(zip(mapFileName)) | ||
.pipe(gulp.dest('dist')); | ||
//build distributable extension | ||
return gulp.src(['build/**', '!build/scripts/**/*.map']) | ||
.pipe(zip(distFileName)) | ||
.pipe(gulp.dest('dist')); | ||
}); | ||
|
||
//run all tasks after build directory has been cleaned | ||
gulp.task('default', ['clean'], function() { | ||
gulp.start('zip'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "avim-chrome", | ||
"version": "0.7.0", | ||
"description": "avim-chrome ===========", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kimkha/avim-chrome" | ||
}, | ||
"author": "Nguyen Kim Kha <[email protected]>", | ||
"license": "GPLv3", | ||
"bugs": { | ||
"url": "https://github.com/kimkha/avim-chrome/issues" | ||
}, | ||
"homepage": "https://github.com/kimkha/avim-chrome", | ||
"devDependencies": { | ||
"gulp-cleanhtml": "0.0.2", | ||
"gulp-clean": "~0.3.1", | ||
"gulp-minify-css": "~0.3.11", | ||
"gulp-uglify": "~1.0.1", | ||
"gulp-jshint": "~1.9.0", | ||
"gulp-zip": "~2.0.2", | ||
"gulp": "~3.8.10", | ||
"gulp-strip-debug": "~1.0.1" | ||
} | ||
} |