diff --git a/.gitignore b/.gitignore index 79164a61c5..34977ee7df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ node_modules -.idea -script/*.js -script/*.map -tests/*.js -tests/*.map \ No newline at end of file +.idea \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000000..3b3548bba3 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,46 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + cssmin: { + dist: { + options: { + report: 'gzip' + }, + files: { + "dist/spritesheets.css": [ + "css/Mounts.css", + "css/PetEggs.css", + "css/player_sprites.css", + "css/male_sprites.css", + "css/female_sprites.css", + "css/shop_sprites.css", + "css/pet_sprites.css", + "css/achievements.css", + "css/backer.css", + "css/customizer.css" + ] + } + } + }, + + browserify: { + dist: { + src: ["script/index.js"], + dest: "dist/habitrpg-shared.js" + }, + options: { + transform: ['coffeeify'] + //debug: true Huge data uri source map (400kb!) + } + } + + }); + + // Load the plugin that provides the "uglify" task. + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-browserify'); + + // Default task(s). + grunt.registerTask('default', ['cssmin', 'browserify']); + +}; \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index ba06733c21..0000000000 --- a/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -compile: - ./node_modules/browserify/bin/cmd.js -t coffeeify ./script/index.js > browser/browser.js - ./node_modules/browserify/bin/cmd.js -t coffeeify --debug ./script/index.js > browser/browser.debug.js \ No newline at end of file diff --git a/README.md b/README.md index 69ff95c266..fcc3045096 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,30 @@ -Shared resources useful for the multiple HabitRPG repositories, that way all the repositories remain in-sync with common charactaristics. Includes things like: +Shared resources useful for the multiple HabitRPG repositories, that way all the repositories remain in-sync with common characteristics. Includes things like: * Assets - sprites, images, etc * CSS - especially, esp. sprite-sheet mapping * Algorithms - level up algorithm, scoring functions, etc + * View helper functions that may come in handy for multiple client MVCs * Item definitions - weapons, armor, pets ##Installation -`npm install` -`make` +* `npm install` +* `grunt` - after you've made modifications and want to compile the dist files for browser * Node.js * `require ('coffee-script')` - * `var shared = require('./index.js')` or `require('./script/algos.coffee')` if you only need one file. + * `require('./script/algos.coffee')`, `require('./script/helpers.coffee')`, etc. * Browser - * Use `