Skip to content

Commit

Permalink
Update dependencies and improve build automation
Browse files Browse the repository at this point in the history
  • Loading branch information
abemedia committed Aug 7, 2016
1 parent 480f845 commit 83da60e
Show file tree
Hide file tree
Showing 15 changed files with 502 additions and 12,421 deletions.
206 changes: 124 additions & 82 deletions Gruntfile.js
Expand Up @@ -2,89 +2,131 @@

module.exports = function (grunt) {

// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('smoove.jquery.json'),
banner: '/*!\n' +
'* jQuery Smoove v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> Adam Bouqdib\n' +
'* Licensed under <%= pkg.licenses[0].type %> (<%= pkg.licenses[0].url %>) \n*/\n\n',
// Task configuration.
clean: {
files: ['dist']
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['src/jquery.<%= pkg.name %>.js'],
dest: 'dist/jquery.<%= pkg.name %>.js'
},
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/jquery.<%= pkg.name %>.min.js'
},
},
connect: {
server: {
options: {
port: 8085
}
}
},
qunit: {
files: ['test/**/*.html']
},
jshint: {
options: {
jshintrc: true
},
gruntfile: {
src: 'Gruntfile.js'
},
src: {
src: ['src/**/*.js']
},
test: {
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
src: {
files: '<%= jshint.src.src %>',
tasks: ['jshint:src', 'qunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'qunit']
},
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('smoove.jquery.json'),
banner: '/*!\n' +
'* jQuery Smoove v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> Adam Bouqdib\n' +
'* Licensed under <%= pkg.licenses[0].type %> (<%= pkg.licenses[0].url %>) \n*/\n\n',
// Task configuration.
clean: {
files: ['dist']
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['src/jquery.<%= pkg.name %>.js'],
dest: 'dist/jquery.<%= pkg.name %>.js'
},
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/jquery.<%= pkg.name %>.min.js'
},
},
connect: {
server: {
options: {
port: 8085
}
});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
}
},
qunit: {
files: ['test/**/*.html']
},
jshint: {
options: {
jshintrc: true
},
gruntfile: {
src: 'Gruntfile.js'
},
src: {
src: ['src/**/*.js']
},
test: {
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
src: {
files: '<%= jshint.src.src %>',
tasks: ['jshint:src', 'qunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'qunit']
},
},
updatejson: {
options: {
src: 'smoove.jquery.json',
dest: ['bower.json', 'package.json'],
indent: ' ',
fields: ['title', 'description', 'version', 'homepage', 'keywords', 'dependencies']
}
}

});

grunt.registerTask('updatejson', function () {
// set config vars
var options = this.options();
if(typeof(options.dest) === 'string') {
options.dest = [options.dest];
}

// check that all files exist
var files = (JSON.parse(JSON.stringify(options.dest)));
files.push(options.src);
for (var d = 0; d < files.length; d++) {
if (!grunt.file.exists(files[d])) {
grunt.log.error("file " + files[d] + " not found");
return false;
}
}

// read source data
grunt.log.writeln("Reading from " + options.src);
var src = grunt.file.readJSON(options.src);

// update destination files
for (d = 0; d < options.dest.length; d++) {
var data = grunt.file.readJSON(options.dest[d]);
for (var f = 0; f < options.fields.length; f++) {
var field = options.fields[f];
if(typeof(data[field]) !== 'undefined') {
data[field] = src[field];
}
}
grunt.file.write(options.dest[d], JSON.stringify(data, options.indent, 2));
grunt.log.writeln("Updated " + options.dest[d]);
}
});

// Default task.
grunt.registerTask('default', ['jshint', 'qunit', 'clean', 'concat', 'uglify']);
grunt.registerTask('test', ['connect', 'jshint', 'qunit']);
grunt.registerTask('build', ['clean', 'concat', 'uglify']);
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');

grunt.registerTask('test', ['connect', 'jshint', 'qunit']);
grunt.registerTask('build', ['clean', 'concat', 'uglify', 'updatejson']);
grunt.registerTask('default', ['test', 'build']);
};
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -3,15 +3,17 @@ jQuery Smoove - Gorgeous CSS3 Scroll Effects

Smoove makes it easy to implement awesome CSS3 transition effects, making your content smoothly glide into the page as your scroll down the page.

[![Dependency Status](https://dependencyci.com/github/abeMedia/jquery-smoove/badge)](https://dependencyci.com/github/abeMedia/jquery-smoove)


## Setup

### Load from CDN

The easiest way to get up and running is to load jQuery Smoove from [cdnjs](http://cdnjs.com). Make sure jQuery is loaded first though.
The easiest way to get up and running is to load jQuery Smoove from [cdnjs](https://cdnjs.com/libraries/jquery-smoove). Make sure jQuery is loaded first though.

```html
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-smoove/0.2.6/jquery.smoove.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-smoove/0.2.8/jquery.smoove.min.js"></script>
```

### Install with Bower
Expand Down
6 changes: 3 additions & 3 deletions bower.json
@@ -1,7 +1,7 @@
{
"name": "jquery-smoove",
"description": "A simple jQuery plugin for super sexy scrolling effects using CSS3 transitions and transforms.",
"version": "0.2.8",
"description": "A simple jQuery plugin for sexy scrolling effects using CSS3 transitions and transforms.",
"version": "0.2.9",
"main": "dist/jquery.smoove.js",
"homepage": "http://smoove.js.org/",
"authors": [
Expand Down Expand Up @@ -31,4 +31,4 @@
"Gruntfile.js",
"smoove.jquery.json"
]
}
}

0 comments on commit 83da60e

Please sign in to comment.