Permalink
Browse files

Add Grunt as a build tool, closes #84

Size diff between current branch and master
     13000      (+115)  bin/javascripts/jquery.nanoscroller.js
      6623       (+71)  bin/javascripts/jquery.nanoscroller.min.js
      2130       (+55)  bin/javascripts/jquery.nanoscroller.min.js.gz
  • Loading branch information...
1 parent 6302086 commit ec73fcca98b626acdf9bde5864d8f091d5b8ee84 Krister Kari committed Sep 1, 2012
Showing with 228 additions and 16 deletions.
  1. +1 −0 .gitignore
  2. +22 −0 LICENSE-MIT
  3. +11 −7 README.md
  4. +4 −1 bin/javascripts/jquery.nanoscroller.js
  5. +3 −1 bin/javascripts/jquery.nanoscroller.min.js
  6. +12 −6 bin/readme.html
  7. +128 −0 grunt.js
  8. +29 −0 nanoscroller.jquery.json
  9. +18 −0 package.json
  10. +0 −1 tests/spec/nano-spec.js
View
@@ -39,3 +39,4 @@ Thumbs.db
publish.sh
build/.sizecache.json
+node_modules
View
@@ -0,0 +1,22 @@
+Copyright (c) 2012 James Florentino
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
View
@@ -195,22 +195,26 @@ We are still working on doing a horizontal scrolling feature. If you're interest
To build nanoScroller from source you need the following libraries installed:
* Node.js and npm: [homepage / download](http://nodejs.org/)
-* Coffeescript: [homepage](http://coffeescript.org/) | `npm install -g coffee-script`
+* Grunt: [homepage](http://gruntjs.com/) | `npm install -g grunt`
-To allow the build process to convert the README file to HTML you also need:
+If you want to be able to build the README file to HTML you also need:
* Ruby (pre-installed in OS X): [homepage](http://www.ruby-lang.org/en/) | [download](http://www.ruby-lang.org/en/downloads/)
* GCC: [homepage](http://gcc.gnu.org/) | [download for OS X](https://github.com/kennethreitz/osx-gcc-installer)
* Redcarpet: [homepage](https://github.com/tanoku/redcarpet) | `gem install redcarpet` (add `sudo` if needed)
#### How to build & contribute
-1. Make all JS changes in Coffeescript file(s), CSS changes in CSS file(s).
-2. In terminal move to nanoscroller folder and run `cake build`
-3. If you want to check how much the plugin size has changed compared to last build, run `cake size` *
-4. Make sure that all changes are valid and open a pull request.
+1. Make sure that you have [Grunt](http://gruntjs.com/) installed.
+2. In terminal move to nanoscroller folder and run `npm install` to install all dependencies.
+3. Make all Javascript changes in Coffeescript file(s), CSS changes in CSS file(s).
+4. run `grunt` to build nanoScroller
+5. Make sure that all changes are valid and open a pull request.
-\* Uses `sizer.js` from [jQuery project](https://github.com/jquery/jquery/pull/511)
+#### How to run tests
+
+1. You need to have [PhantomJS](http://phantomjs.org/) installed. On Mac OS X the easiest way is to install [Homebrew](http://mxcl.github.com/homebrew/) and run `brew install phantomjs`.
+2. run `grunt test` in terminal
### Browser compatibility
@@ -1,4 +1,7 @@
-// Generated by CoffeeScript 1.3.3
+/*! nanoScrollerJS - v0.6.9 - 2012-09-02
+* http://jamesflorentino.github.com/nanoScrollerJS/
+* Copyright (c) 2012 James Florentino; Licensed MIT */
+
(function($, window, document) {
"use strict";
Oops, something went wrong.
View
@@ -220,10 +220,10 @@
<ul>
<li>Node.js and npm: <a href="http://nodejs.org/">homepage / download</a></li>
-<li>Coffeescript: <a href="http://coffeescript.org/">homepage</a> | <code>npm install -g coffee-script</code></li>
+<li>Grunt: <a href="http://gruntjs.com/">homepage</a> | <code>npm install -g grunt</code></li>
</ul>
-<p>To allow the build process to convert the README file to HTML you also need:</p>
+<p>If you want to be able to build the README file to HTML you also need:</p>
<ul>
<li>Ruby (pre-installed in OS X): <a href="http://www.ruby-lang.org/en/">homepage</a> | <a href="http://www.ruby-lang.org/en/downloads/">download</a></li>
@@ -234,13 +234,19 @@
<h4>How to build &amp; contribute</h4>
<ol>
-<li>Make all JS changes in Coffeescript file(s), CSS changes in CSS file(s).</li>
-<li>In terminal move to nanoscroller folder and run <code>cake build</code></li>
-<li>If you want to check how much the plugin size has changed compared to last build, run <code>cake size</code> *</li>
+<li>Make sure that you have <a href="http://gruntjs.com/">Grunt</a> installed.</li>
+<li>In terminal move to nanoscroller folder and run <code>npm install</code> to install all dependencies.</li>
+<li>Make all Javascript changes in Coffeescript file(s), CSS changes in CSS file(s).</li>
+<li>run <code>grunt</code> to build nanoScroller</li>
<li>Make sure that all changes are valid and open a pull request.</li>
</ol>
-<p>* Uses <code>sizer.js</code> from <a href="https://github.com/jquery/jquery/pull/511">jQuery project</a></p>
+<h4>How to run tests</h4>
+
+<ol>
+<li>You need to have <a href="http://phantomjs.org/">PhantomJS</a> installed. On Mac OS X the easiest way is to install <a href="http://mxcl.github.com/homebrew/">Homebrew</a> and run <code>brew install phantomjs</code>.</li>
+<li>run <code>grunt test</code> in terminal</li>
+</ol>
<h3>Browser compatibility</h3>
View
128 grunt.js
@@ -0,0 +1,128 @@
+/*global module:false*/
+module.exports = function(grunt) {
+
+ grunt.loadNpmTasks('grunt-jasmine-task');
+ grunt.loadNpmTasks('grunt-coffee');
+ grunt.loadNpmTasks('grunt-css');
+ grunt.loadNpmTasks('grunt-closure-tools');
+ grunt.loadNpmTasks('grunt-sizediff');
+ grunt.loadNpmTasks('grunt-shell');
+
+ // Project configuration.
+ grunt.initConfig({
+ dirs: {
+ coffeeDir: 'coffeescripts',
+ jsDir: 'bin/javascripts',
+ cssDir: 'bin/css',
+ testDir: 'tests'
+ },
+ pkg: '<json:nanoscroller.jquery.json>',
+ meta: {
+ unmin: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',
+ min: '/*! <%= pkg.title || pkg.name %> v<%= pkg.version %> ' +
+ '(c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
+ },
+ concat: {
+ unmin: {
+ src: ['<banner:meta.unmin>', '<file_strip_banner:bin/javascripts/<%= pkg.name %>.js>'],
+ dest: '<%= dirs.jsDir %>/<%= pkg.name %>.js'
+ },
+ min: {
+ src: ['<banner:meta.min>', '<file_strip_banner:bin/javascripts/<%= pkg.name %>.min.js>'],
+ dest: '<%= dirs.jsDir %>/<%= pkg.name %>.min.js'
+ }
+ },
+ csslint: {
+ all: {
+ src: '<%= dirs.cssDir %>/nanoscroller.css',
+ rules: {
+ 'fallback-colors': false,
+ 'known-properties': false,
+ 'compatible-vendor-prefixes': false,
+ 'adjoining-classes': false,
+ 'empty-rules': true,
+ 'zero-units': true,
+ ids: true,
+ important: true
+ }
+ }
+ },
+ coffee: {
+ nano: {
+ src: ['<%= dirs.coffeeDir %>/*.coffee'],
+ dest: '<%= dirs.jsDir %>',
+ options: {
+ bare: true
+ }
+ },
+ tests: {
+ src: ['<%= dirs.testDir %>/coffeescripts/*.coffee'],
+ dest: '<%= dirs.testDir %>/spec'
+ }
+ },
+ closureCompiler: {
+ all: {
+ closureCompiler: 'build/compiler.jar',
+ js: '<%= dirs.jsDir %>/<%= pkg.name %>.js',
+ output_file: '<%= dirs.jsDir %>/<%= pkg.name %>.min.js',
+ options: {
+ compilation_level: 'SIMPLE_OPTIMIZATIONS'
+ }
+ }
+ },
+ sizediff: {
+ all: {
+ files: [
+ '<%= dirs.jsDir %>/<%= pkg.name %>.js',
+ '<%= dirs.jsDir %>/<%= pkg.name %>.min.js'
+ ]
+ }
+ },
+ jasmine: {
+ all: ['<%= dirs.testDir %>/SpecRunner.html']
+ },
+ lint: {
+ files: ['grunt.js']
+ },
+ watch: {
+ files: '<config:coffee.nano.src>',
+ tasks: 'default'
+ },
+ jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true,
+ browser: true
+ },
+ globals: {
+ jQuery: true
+ }
+ },
+ shell: {
+ redcarpet: {
+ command: 'redcarpet README.md > bin/readme.html',
+ stdout: true
+ }
+ }
+ });
+
+ grunt.registerTask('default', 'coffee:nano closureCompiler concat:unmin concat:min csslint lint sizediff');
+ grunt.registerTask('build', 'default');
+ grunt.registerTask('build:tests', 'coffee:tests');
+ grunt.registerTask('build:readme', 'shell:redcarpet');
+ grunt.registerTask('test', 'coffee:tests jasmine');
+ grunt.registerTask('size', 'sizediff');
+};
View
@@ -0,0 +1,29 @@
+{
+ "name": "jquery.nanoscroller",
+ "title": "nanoScrollerJS",
+ "description": "A jQuery plugin that offers a simplistic way of implementing Lion OS scrollbars.",
+ "version": "0.6.9",
+ "homepage": "http://jamesflorentino.github.com/nanoScrollerJS/",
+ "author": {
+ "name": "James Florentino",
+ "email": "j@jamesflorentino.com",
+ "url": "http://www.jamesflorentino.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/jamesflorentino/nanoScrollerJS.git"
+ },
+ "bugs": {
+ "url": "https://github.com/jamesflorentino/nanoScrollerJS/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://jamesflorentino.github.com/nanoScrollerJS//blob/master/LICENSE-MIT"
+ }
+ ],
+ "dependencies": {
+ "jquery": ">= 1.6"
+ },
+ "keywords": []
+}
View
@@ -0,0 +1,18 @@
+{
+ "name": "jquery-plugin",
+ "version": "0.0.0-ignored",
+ "engines": {
+ "node": ">= 0.6.0"
+ },
+ "dependencies": {
+ "grunt-css": ">= 0.2.1",
+ "grunt-coffee": ">= 0.0.6",
+ "grunt-jasmine-task": ">= 0.2.2",
+ "grunt-closure-tools": ">= 0.6.3",
+ "grunt-sizediff": ">= 0.2.1",
+ "grunt-shell": ">= 0.1.3"
+ },
+ "devDependencies": {
+ "grunt": "~0.3.14"
+ }
+}
View
@@ -1,4 +1,3 @@
-// Generated by CoffeeScript 1.3.3
describe("nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)", function() {
var $content, $nano, $pane, $slider, height, spyScrollend, spyScrolltop;

0 comments on commit ec73fcc

Please sign in to comment.