Skip to content

Commit

Permalink
🇬🇧 Refactored build to use gulp.
Browse files Browse the repository at this point in the history
  • Loading branch information
wagerfield committed Apr 20, 2014
1 parent a42beb9 commit f1b54b5
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.DS_Store
build/node_modules
node_modules
assets
File renamed without changes.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,17 @@ and create a reference to the **UIWebView** `@property(nonatomic, strong) IBOutl
## Build
> As a prerequisite, you will need [gulp][gulp] installed: `npm install -g gulp`
```
cd build
npm install
node build.js
gulp
```
During development you can have gulp watch the `source` directory for changes and automatically build the `deploy` files by running:
```
gulp watch
```
## Author
Expand All @@ -203,3 +210,4 @@ Licensed under [MIT][mit]. Enjoy.
[mit]: http://www.opensource.org/licenses/mit-license.php
[jquery]: http://jquery.com/
[zepto]: http://zeptojs.com/
[gulp]: http://gulpjs.com/
5 changes: 2 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "parallax",
"description": "Parallax Engine that reacts to the orientation of a smart device.",
"version": "1.0.0",
"license": "MIT",
"homepage": "http://wagerfield.github.io/parallax/",
"authors": [
"Matthew Wagerfield <[email protected]>"
Expand All @@ -11,12 +13,9 @@
"deploy/jquery.parallax.js",
"deploy/jquery.parallax.min.js"
],
"description": "Simple, lightweight Parallax Engine that reacts to the orientation of a smart device. Where no gyroscope or motion detection hardware is available, the position of the cursor is used instead.",
"license": "MIT",
"ignore": [
"**/.*",
"assets",
"build",
"source",
"examples"
],
Expand Down
53 changes: 0 additions & 53 deletions build/build.js

This file was deleted.

20 changes: 0 additions & 20 deletions build/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/jquery.parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
;(function($, window, document, undefined) {

// Strict Mode
"use strict";
'use strict';

// Constants
var NAME = 'parallax';
Expand Down
32 changes: 1 addition & 31 deletions deploy/jquery.parallax.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deploy/parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
;(function(window, document, undefined) {

// Strict Mode
"use strict";
'use strict';

// Constants
var NAME = 'Parallax';
Expand Down
32 changes: 1 addition & 31 deletions deploy/parallax.min.js

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var gulp = require('gulp'),
plugins = require("gulp-load-plugins")();

function build(stream, file) {
return stream
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.concat(file))
.pipe(gulp.dest('deploy'))
.pipe(plugins.rename({suffix: '.min'}))
.pipe(plugins.uglify())
.pipe(gulp.dest('deploy'));
}

gulp.task('build.parallax', function() {
return build(gulp.src([
'LICENSE',
'source/parallax.js',
'source/requestAnimationFrame.js'
]), 'parallax.js');
});

gulp.task('build.jquery.parallax', function() {
return build(gulp.src([
'LICENSE',
'source/jquery.parallax.js',
'source/requestAnimationFrame.js'
]), 'jquery.parallax.js');
});

gulp.task('clean', function() {
return gulp.src(['deploy'], {read: false}).pipe(plugins.clean());
});

gulp.task('build', ['clean'], function() {
gulp.start('build.parallax', 'build.jquery.parallax');
});

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

gulp.task('default', ['build']);
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "parallax",
"description": "Parallax Engine that reacts to the orientation of a smart device.",
"version": "1.0.0",
"license": "MIT",
"homepage": "http://wagerfield.github.io/parallax/",
"author": "Matthew Wagerfield <[email protected]>",
"directories": {
"example": "examples"
},
"scripts": {
"build": "gulp"
},
"repository": {
"type": "git",
"url": "git://github.com/wagerfield/parallax.git"
},
"keywords": [
"parallax",
"gyroscope",
"jquery",
"javascript",
"library"
],
"bugs": {
"url": "https://github.com/wagerfield/parallax/issues"
},
"devDependencies": {
"gulp": "^3.6.1",
"gulp-load-plugins": "^0.5.0",
"gulp-clean": "^0.2.4",
"gulp-concat": "^2.2.0",
"gulp-notify": "^1.2.5",
"gulp-rename": "^1.2.0",
"gulp-jshint": "^1.5.3",
"gulp-uglify": "^0.2.1",
"jshint-stylish": "^0.1.5"
}
}
2 changes: 1 addition & 1 deletion source/jquery.parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
;(function($, window, document, undefined) {

// Strict Mode
"use strict";
'use strict';

// Constants
var NAME = 'parallax';
Expand Down
2 changes: 1 addition & 1 deletion source/parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
;(function(window, document, undefined) {

// Strict Mode
"use strict";
'use strict';

// Constants
var NAME = 'Parallax';
Expand Down

0 comments on commit f1b54b5

Please sign in to comment.