Skip to content

Commit f1b54b5

Browse files
committed
🇬🇧 Refactored build to use gulp.
1 parent a42beb9 commit f1b54b5

14 files changed

+101
-145
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*.DS_Store
2-
build/node_modules
2+
node_modules
33
assets

LICENSE.md LICENSE

File renamed without changes.

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,17 @@ and create a reference to the **UIWebView** `@property(nonatomic, strong) IBOutl
184184
185185
## Build
186186
187+
> As a prerequisite, you will need [gulp][gulp] installed: `npm install -g gulp`
188+
187189
```
188-
cd build
189190
npm install
190-
node build.js
191+
gulp
192+
```
193+
194+
During development you can have gulp watch the `source` directory for changes and automatically build the `deploy` files by running:
195+
196+
```
197+
gulp watch
191198
```
192199
193200
## Author
@@ -203,3 +210,4 @@ Licensed under [MIT][mit]. Enjoy.
203210
[mit]: http://www.opensource.org/licenses/mit-license.php
204211
[jquery]: http://jquery.com/
205212
[zepto]: http://zeptojs.com/
213+
[gulp]: http://gulpjs.com/

bower.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "parallax",
3+
"description": "Parallax Engine that reacts to the orientation of a smart device.",
34
"version": "1.0.0",
5+
"license": "MIT",
46
"homepage": "http://wagerfield.github.io/parallax/",
57
"authors": [
68
"Matthew Wagerfield <[email protected]>"
@@ -11,12 +13,9 @@
1113
"deploy/jquery.parallax.js",
1214
"deploy/jquery.parallax.min.js"
1315
],
14-
"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.",
15-
"license": "MIT",
1616
"ignore": [
1717
"**/.*",
1818
"assets",
19-
"build",
2019
"source",
2120
"examples"
2221
],

build/build.js

-53
This file was deleted.

build/package.json

-20
This file was deleted.

deploy/jquery.parallax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
;(function($, window, document, undefined) {
4040

4141
// Strict Mode
42-
"use strict";
42+
'use strict';
4343

4444
// Constants
4545
var NAME = 'parallax';

deploy/jquery.parallax.min.js

+1-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/parallax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
;(function(window, document, undefined) {
4040

4141
// Strict Mode
42-
"use strict";
42+
'use strict';
4343

4444
// Constants
4545
var NAME = 'Parallax';

deploy/parallax.min.js

+1-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
var gulp = require('gulp'),
2+
plugins = require("gulp-load-plugins")();
3+
4+
function build(stream, file) {
5+
return stream
6+
.pipe(plugins.jshint())
7+
.pipe(plugins.jshint.reporter('jshint-stylish'))
8+
.pipe(plugins.concat(file))
9+
.pipe(gulp.dest('deploy'))
10+
.pipe(plugins.rename({suffix: '.min'}))
11+
.pipe(plugins.uglify())
12+
.pipe(gulp.dest('deploy'));
13+
}
14+
15+
gulp.task('build.parallax', function() {
16+
return build(gulp.src([
17+
'LICENSE',
18+
'source/parallax.js',
19+
'source/requestAnimationFrame.js'
20+
]), 'parallax.js');
21+
});
22+
23+
gulp.task('build.jquery.parallax', function() {
24+
return build(gulp.src([
25+
'LICENSE',
26+
'source/jquery.parallax.js',
27+
'source/requestAnimationFrame.js'
28+
]), 'jquery.parallax.js');
29+
});
30+
31+
gulp.task('clean', function() {
32+
return gulp.src(['deploy'], {read: false}).pipe(plugins.clean());
33+
});
34+
35+
gulp.task('build', ['clean'], function() {
36+
gulp.start('build.parallax', 'build.jquery.parallax');
37+
});
38+
39+
gulp.task('watch', function() {
40+
gulp.watch('source/**/*.js', ['build']);
41+
});
42+
43+
gulp.task('default', ['build']);

package.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "parallax",
3+
"description": "Parallax Engine that reacts to the orientation of a smart device.",
4+
"version": "1.0.0",
5+
"license": "MIT",
6+
"homepage": "http://wagerfield.github.io/parallax/",
7+
"author": "Matthew Wagerfield <[email protected]>",
8+
"directories": {
9+
"example": "examples"
10+
},
11+
"scripts": {
12+
"build": "gulp"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "git://github.com/wagerfield/parallax.git"
17+
},
18+
"keywords": [
19+
"parallax",
20+
"gyroscope",
21+
"jquery",
22+
"javascript",
23+
"library"
24+
],
25+
"bugs": {
26+
"url": "https://github.com/wagerfield/parallax/issues"
27+
},
28+
"devDependencies": {
29+
"gulp": "^3.6.1",
30+
"gulp-load-plugins": "^0.5.0",
31+
"gulp-clean": "^0.2.4",
32+
"gulp-concat": "^2.2.0",
33+
"gulp-notify": "^1.2.5",
34+
"gulp-rename": "^1.2.0",
35+
"gulp-jshint": "^1.5.3",
36+
"gulp-uglify": "^0.2.1",
37+
"jshint-stylish": "^0.1.5"
38+
}
39+
}

source/jquery.parallax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
;(function($, window, document, undefined) {
99

1010
// Strict Mode
11-
"use strict";
11+
'use strict';
1212

1313
// Constants
1414
var NAME = 'parallax';

source/parallax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
;(function(window, document, undefined) {
99

1010
// Strict Mode
11-
"use strict";
11+
'use strict';
1212

1313
// Constants
1414
var NAME = 'Parallax';

0 commit comments

Comments
 (0)