Skip to content

remove jQuery or Zepto dependency #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/plugins/jquery.ajax.js
53 changes: 50 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ var source = require('vinyl-source-stream');
var connect = require('gulp-connect');
var notify = require('gulp-notify');

var uglify = require('gulp-uglify');
var pump = require('pump');

var fs = require('fs');
var builder = require('jquery-custom');

gulp.task('build', function () {
var isDevelopment = process.env.NODE_ENV === 'develop',
browserifyOpts = {
Expand All @@ -18,12 +24,21 @@ gulp.task('build', function () {
return browserify('./src/qbMain.js', browserifyOpts)
.bundle()
.on('error', function(error) {
notify('Failed when create a bundle <%= error.message %>')
notify('Failed when create a bundle <%= error.message %>');
this.emit('end');
})
.pipe(source('quickblox.min.js'))
.pipe(notify('Build task is finished.'))
.pipe(gulp.dest('./'));
.pipe(gulp.dest('./'))
.pipe(notify('Build task is finished.'));
});

gulp.task('minify', function () {
pump([
gulp.src('./quickblox.min.js'),
uglify(),
notify('Minify task is finished.'),
gulp.dest('./')
]);
});

gulp.task('connect', function() {
Expand Down Expand Up @@ -57,6 +72,38 @@ gulp.task('generate-build_version', function() {
});
});

gulp.task('jquery', function () {
return builder({
flags: [
'-deprecated',
'-dimensions',
'-effects',
'-event',
'-event/alias',
'-event/focusin',
'-event/trigger',
'-offset',
'-wrap',
'-core/ready',
'-exports/global',
'-sizzle'
],
}, function (err, compiledContent) {
if (err){
notify('Can\'t build jquery lib.');
return console.error(err);
}

fs.writeFile('./src/plugins/jquery.ajax.js', compiledContent, function (err) {
if (err){
notify('Can\'t build jquery lib.');
return console.error(err);
}
notify('Jquery task is finished.');
})
})
});

gulp.task('watch', function () {
gulp.watch(['./src/**/*.js'], ['build']);
});
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@
"gulp": "^3.9.1",
"gulp-connect": "^5.0.0",
"gulp-notify": "^2.2.0",
"gulp-uglify": "^2.0.0",
"jasmine": "^2.4.1",
"jquery-custom": "^1.1.1",
"jshint": "^2.9.3",
"jshint-stylish": "^2.2.1",
"pump": "^1.0.1",
"vinyl-source-stream": "^1.1.0"
},
"autoupdate": {
Expand All @@ -74,7 +77,7 @@
"scripts": {
"setDependencies": "npm i && npm install -g gulp-cli && npm install -g jasmine",
"lint": "jshint src --reporter=node_modules/jshint-stylish",
"build": "npm run lint && gulp generate-build_version && gulp build",
"build": "npm run lint && gulp generate-build_version && gulp build && gulp minify",
"develop": "cross-env NODE_ENV=develop gulp",
"start": "gulp connect"
}
Expand Down
Loading