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 3 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
47 changes: 43 additions & 4 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('build_min', ['build'], function () {
pump([
gulp.src('./quickblox.min.js'),
uglify(),
notify('Compress task is finished.'),
gulp.dest('./')
]);
});

gulp.task('connect', function() {
Expand Down Expand Up @@ -57,8 +72,32 @@ 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) return console.error(err);
fs.writeFile('./src/plugins/jquery.ajax.js', compiledContent, function (err) {
if (err) return console.error(err);
Copy link
Contributor

@dimaspirit dimaspirit Nov 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also use notify for notify module about a crash process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure?

})
})
});

gulp.task('watch', function () {
gulp.watch(['./src/**/*.js'], ['build']);
});

gulp.task('default', ['build', 'connect', 'watch']);
gulp.task('default', ['build_sdk', 'connect', 'watch']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you find the task build_sdk?

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_min",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to build and minify. Like this "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