mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Tabify src
This commit is contained in:
parent
f6247e5612
commit
32993dc58c
31 changed files with 7759 additions and 7758 deletions
162
gulpfile.js
162
gulpfile.js
|
@ -6,7 +6,7 @@ var uglify = require('gulp-uglify');
|
|||
var gutil = require('gulp-util');
|
||||
var plumber = require('gulp-plumber');
|
||||
var onError = function (err) {
|
||||
gutil.log(gutil.colors.green(err));
|
||||
gutil.log(gutil.colors.green(err));
|
||||
};
|
||||
var server = require("./tools/serve.js");
|
||||
|
||||
|
@ -24,73 +24,73 @@ var mochify = require('mochify');
|
|||
|
||||
// Lint JS
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src('src/*.js')
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter('default'));
|
||||
return gulp.src('src/*.js')
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter('default'));
|
||||
});
|
||||
|
||||
// set up the browserify instance on a task basis
|
||||
gulp.task('bundle', function () {
|
||||
return bundle('epub.js');
|
||||
return bundle('epub.js');
|
||||
});
|
||||
|
||||
// Minify JS
|
||||
gulp.task('minify', ['bundle'], function(){
|
||||
var uglifyOptions = {
|
||||
mangle: true,
|
||||
preserveComments : "license"
|
||||
};
|
||||
return gulp.src('dist/epub.js')
|
||||
.pipe(plumber({ errorHandler: onError }))
|
||||
.pipe(rename('epub.min.js'))
|
||||
// .pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(uglify(uglifyOptions))
|
||||
// .pipe(sourcemaps.write('./'))
|
||||
.pipe(size({ showFiles: true }))
|
||||
.pipe(gulp.dest('dist'));
|
||||
var uglifyOptions = {
|
||||
mangle: true,
|
||||
preserveComments : "license"
|
||||
};
|
||||
return gulp.src('dist/epub.js')
|
||||
.pipe(plumber({ errorHandler: onError }))
|
||||
.pipe(rename('epub.min.js'))
|
||||
// .pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(uglify(uglifyOptions))
|
||||
// .pipe(sourcemaps.write('./'))
|
||||
.pipe(size({ showFiles: true }))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
// Watch Our Files
|
||||
gulp.task('watch', function(cb) {
|
||||
bundle('epub.js', cb);
|
||||
bundle('epub.js', cb);
|
||||
});
|
||||
|
||||
gulp.task('serve', function(cb) {
|
||||
server();
|
||||
bundle('epub.js', cb);
|
||||
server();
|
||||
bundle('epub.js', cb);
|
||||
});
|
||||
|
||||
gulp.task('serve:no-watch', function(cb) {
|
||||
server();
|
||||
server();
|
||||
});
|
||||
|
||||
gulp.task('test', function(cb) {
|
||||
mochify('./test/*.js', {
|
||||
reporter: 'spec',
|
||||
transform: 'brfs',
|
||||
"web-security": false,
|
||||
"webSecurityEnabled": false,
|
||||
// "localUrlAccess": true,
|
||||
watch: true,
|
||||
wd: false,
|
||||
debug: false
|
||||
})
|
||||
.bundle();
|
||||
mochify('./test/*.js', {
|
||||
reporter: 'spec',
|
||||
transform: 'brfs',
|
||||
"web-security": false,
|
||||
"webSecurityEnabled": false,
|
||||
// "localUrlAccess": true,
|
||||
watch: true,
|
||||
wd: false,
|
||||
debug: false
|
||||
})
|
||||
.bundle();
|
||||
});
|
||||
|
||||
|
||||
gulp.task('test:once', function(cb) {
|
||||
mochify('./test/*.js', {
|
||||
reporter: 'spec',
|
||||
transform: 'brfs',
|
||||
"web-security": false,
|
||||
"webSecurityEnabled": false,
|
||||
// "localUrlAccess": true,
|
||||
watch: false,
|
||||
wd: false,
|
||||
debug: false
|
||||
})
|
||||
.bundle();
|
||||
mochify('./test/*.js', {
|
||||
reporter: 'spec',
|
||||
transform: 'brfs',
|
||||
"web-security": false,
|
||||
"webSecurityEnabled": false,
|
||||
// "localUrlAccess": true,
|
||||
watch: false,
|
||||
wd: false,
|
||||
debug: false
|
||||
})
|
||||
.bundle();
|
||||
});
|
||||
|
||||
// Default
|
||||
|
@ -98,51 +98,51 @@ gulp.task('default', ['lint', 'bundle']);
|
|||
|
||||
|
||||
function bundle(file, watch) {
|
||||
var opt = {
|
||||
entries: ['src/'+file],
|
||||
standalone: 'ePub',
|
||||
debug : true
|
||||
};
|
||||
var opt = {
|
||||
entries: ['src/'+file],
|
||||
standalone: 'ePub',
|
||||
debug : true
|
||||
};
|
||||
|
||||
var b = browserify(opt);
|
||||
var b = browserify(opt);
|
||||
|
||||
// Expose epub module for require
|
||||
b.require('./src/'+file, {expose: 'epub'});
|
||||
// Expose epub module for require
|
||||
b.require('./src/'+file, {expose: 'epub'});
|
||||
|
||||
// Keep JSZip library seperate,
|
||||
// must be loaded to use Unarchive or `require` will throw an error
|
||||
b.external('jszip');
|
||||
// Keep JSZip library seperate,
|
||||
// must be loaded to use Unarchive or `require` will throw an error
|
||||
b.external('jszip');
|
||||
|
||||
b.external('xmldom');
|
||||
b.external('xmldom');
|
||||
|
||||
// Ignore optional URI libraries
|
||||
var urijsPath = URI(require.resolve('urijs'));
|
||||
['./punycode.js', './IPv6.js'].forEach(function(lib) {
|
||||
var libPath = URI(lib).absoluteTo(urijsPath).toString();
|
||||
b.ignore(libPath);
|
||||
});
|
||||
// Ignore optional URI libraries
|
||||
var urijsPath = URI(require.resolve('urijs'));
|
||||
['./punycode.js', './IPv6.js'].forEach(function(lib) {
|
||||
var libPath = URI(lib).absoluteTo(urijsPath).toString();
|
||||
b.ignore(libPath);
|
||||
});
|
||||
|
||||
// watchify() if watch requested, otherwise run browserify() once
|
||||
var bundler = watch ? watchify(b) : b;
|
||||
// watchify() if watch requested, otherwise run browserify() once
|
||||
var bundler = watch ? watchify(b) : b;
|
||||
|
||||
function rebundle() {
|
||||
var stream = bundler.bundle();
|
||||
return stream
|
||||
.on('error', gutil.log)
|
||||
.pipe(source(file))
|
||||
.pipe(buffer())
|
||||
.pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(sourcemaps.write('./'))
|
||||
.pipe(size({ showFiles: true }))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
}
|
||||
function rebundle() {
|
||||
var stream = bundler.bundle();
|
||||
return stream
|
||||
.on('error', gutil.log)
|
||||
.pipe(source(file))
|
||||
.pipe(buffer())
|
||||
.pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(sourcemaps.write('./'))
|
||||
.pipe(size({ showFiles: true }))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
}
|
||||
|
||||
// listen for an update and run rebundle
|
||||
bundler.on('update', function() {
|
||||
rebundle();
|
||||
gutil.log('Rebundle...');
|
||||
});
|
||||
// listen for an update and run rebundle
|
||||
bundler.on('update', function() {
|
||||
rebundle();
|
||||
gutil.log('Rebundle...');
|
||||
});
|
||||
|
||||
// run it once the first time buildScript is called
|
||||
return rebundle();
|
||||
// run it once the first time buildScript is called
|
||||
return rebundle();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue