From f65c9cb0bb9a78791835ef8b703f262eb2a318c6 Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Sat, 15 Jun 2013 23:45:57 +0900 Subject: [PATCH] Add files for Grunt. --- Gruntfile.js | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 14 +++++++++ 2 files changed, 95 insertions(+) create mode 100644 Gruntfile.js create mode 100644 package.json diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..59a1631 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,81 @@ +'use strict'; + +module.exports = function (grunt) { + + // Project configuration. + grunt.initConfig({ + // Metadata. + pkg: grunt.file.readJSON('perfect-scrollbar.jquery.json'), + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', + // Task configuration. + uglify: { + options: { + banner: '<%= banner %>' + }, + min: { + files: { + 'min/perfect-scrollbar.min.js': ['src/perfect-scrollbar.js'], + 'min/perfect-scrollbar.with-mousewheel.min.js': [ + 'src/perfect-scrollbar.js', + 'src/jquery.mousewheel.js' + ] + } + }, + }, + jshint: { + gruntfile: { + options: { + jshintrc: '.jshintrc' + }, + src: 'Gruntfile.js' + }, + src: { + options: { + jshintrc: '.jshintrc' + }, + src: 'src/perfect-scrollbar.js' + } + }, + csslint: { + strict: { + options: { + csslintrc: '.csslintrc', + import: 2 + }, + src: ['src/perfect-scrollbar.css'] + } + }, + cssmin: { + options: { + banner: '<%= banner %>' + }, + minify: { + expand: true, + cwd: 'src/', + src: ['perfect-scrollbar.css'], + dest: 'min/', + ext: '.min.css' + } + } + }); + + // These plugins provide necessary tasks. + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-csslint'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + + grunt.registerTask('default', 'List commands', function () { + grunt.log.writeln(""); + + grunt.log.writeln("Run 'grunt lint' to lint the source files"); + grunt.log.writeln("Run 'grunt build' to minify the source files"); + }); + + grunt.registerTask('lint', ['jshint', 'csslint']); + grunt.registerTask('build', ['uglify', 'cssmin']); + +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..97b262e --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "perfect-scrollbar", + "version": "0.3.4", + "engines": { + "node": ">= 0.8.0" + }, + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-jshint": "~0.1.1", + "grunt-contrib-uglify": "~0.1.1", + "grunt-contrib-cssmin": "~0.6.1", + "grunt-contrib-csslint": "~0.1.2" + } +}