Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
switched to site, bin, and README layout
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbender committed Oct 7, 2013
1 parent b2d3968 commit f67ed46
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 476 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
node_modules
dist*
68 changes: 62 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,80 @@
/*global module:false*/

var childProc = require("child_process");

module.exports = function(grunt) {
var lintFiles = ['Gruntfile.js', 'src/*.js', 'test/**/*.js'];
var pkg, minfiles = {},
lintFiles = ['Gruntfile.js', 'src/*.js', 'test/**/*.js'],
pluginNamespaces = [
"ajax",
"autoplay",
"drag",
"dynamic-containers",
"flip",
"keybd",
"loop",
"pagination",
"touch"
];


// Minify all the plugins
pluginNamespaces.forEach(function( namespace, i ) {
minfiles[ "dist/<%= pkg.name %>." + namespace + ".min.js" ] =
[ "dist/<%= pkg.name %>." + namespace + ".js" ];
});

// Minify the main concatenated files
minfiles[ "dist/<%= pkg.name %>.min.js" ] = [ "dist/<%= pkg.name %>.js" ];

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkg: pkg = grunt.file.readJSON('package.json'),
meta: {
banner: '/*! <%= 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(", ") %> */'
},

concat: {
dist: {
src: ['<banner:meta.banner>', 'src/responsive-carousel.js', 'src/responsive-carousel.touch.js', 'src/responsive-carousel.drag.js', 'src/responsive-carousel.pagination.js', 'src/responsive-carousel.autoinit.js' ],
dest: 'dist/<%= pkg.name %>.js'
}
},

copy: {
plugins: {
files: [
{
expand: true,
// NOTE prevent overwritting by only pulling namespaced files
src: "src/*.*.js",
dest: "dist/",
filter: "isFile",
flatten: true
},

{
expand: true,
src: "src/*.css",
dest: "dist/",
filter: "isFile",
flatten: true
}
]
}
},

uglify: {
options: {
banner: '<banner:meta.banner>'
},

dist: {
files: {
'dist/<%= pkg.name %>.min.js': [ 'dist/<%= pkg.name %>.js' ]
}
files: minfiles
}
},

Expand All @@ -49,9 +97,17 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');

grunt.task.registerTask( "compress", "compress the dist folder", function() {
var done = this.async();
childProc.exec( "tar czf dist-" + pkg.version + ".tar.gz dist", function() {
done();
});
});

// Default task.
grunt.registerTask('default', 'jshint qunit concat uglify'.split( " " ));
grunt.registerTask('default', 'jshint qunit copy:plugins concat uglify'.split( " " ));

// Travis
grunt.registerTask('travis', 'jshint qunit'.split( " " ));
Expand Down
Loading

0 comments on commit f67ed46

Please sign in to comment.