diff --git a/.gitignore b/.gitignore index cb33b33..dd4bd82 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ compiled/css/timeline-generator.css *.tmproj *.tmproject tmtags -source/gfx/Sprites/ \ No newline at end of file +source/gfx/Sprites/ +/node_modules \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..49b3855 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,53 @@ +'use strict'; + +// Variables +var path = require('path'); + +module.exports = function(grunt) { + + // Project configuration + grunt.initConfig({ + // Configs + pkg: grunt.file.readJSON('package.json'), + timeline: { + compiled: 'compiled', + website: '../timeline.knightlab.com' + }, + + // Banner for the top of CSS and JS files + // Note: The existing Timeline repo has its own banner, so we'll ignore this for now + banner: '/* <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + + ' * <%= pkg.homepage %>\n' + + ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;\n' + + ' */\n', + + // Copy + copy: { + website: { + files: [ + // Styles/Themes + { expand: true, cwd: '<%= timeline.compiled %>/css', src: ['*.css', 'themes/**'], dest: '<%= timeline.website %>/static/css'}, + + // Scripts + { expand: true, cwd: '<%= timeline.compiled %>/js', src: ['**/*.js'], dest: '<%= timeline.website %>/static/js'}, + + // Images + { expand: true, cwd: '<%= timeline.compiled %>/css', src: ['*.{png,gif,jpg}'], dest: '<%= timeline.website %>/static/img'} + ] + } + } + }); + + // Load all Grunt tasks + require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); + + // Task aliases + grunt.registerTask('check', 'Check for the timeline.knightlab.com repository', function() { + // Make sure CDN repo exists + if(!grunt.file.exists(grunt.config.get('timeline.website'))) { + grunt.fatal('Could not find local website repository.') + } + }); + + grunt.registerTask('website', "Copy select files to the timeline.knightlab.com website repository", ['check', 'copy']); +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..71872bb --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "TimelineJS", + "version": "2.22.0", + "author": "Zach Wise", + "homepage": "https://github.com/NUKnightLab/TimelineJS", + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-copy": "~0.4.0", + "matchdep": "~0.1.1" + } +}