Last active
December 21, 2015 16:09
-
-
Save intellix/6331191 to your computer and use it in GitHub Desktop.
GruntJS for development and production.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
css_dir = "public/css" | |
sass_dir = "sass" | |
images_dir = "public/img" | |
javascripts_dir = "public/js" | |
fonts_dir = "public/fonts" | |
http_path = "/" | |
http_images_path = "http://konorogames.konorogames.netdna-cdn.com" | |
http_fonts_path = "../fonts" | |
http_generated_images_path = http_images_path | |
output_style = :compressed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
css_dir = "public/css" | |
sass_dir = "sass" | |
images_dir = "public/img" | |
javascripts_dir = "public/js" | |
fonts_dir = "public/fonts" | |
http_path = "/" | |
http_images_path = "../img" | |
http_fonts_path = "../fonts" | |
http_generated_images_path = http_images_path | |
sass_options = { :sourcemap => true } | |
output_style = :expanded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
compass: { | |
files: [ | |
'sass/**/*.scss' | |
] | |
clean: { | |
options: { | |
clean: true | |
} | |
}, | |
dev: { | |
options: { | |
config: 'config.rb' | |
} | |
}, | |
prod: { | |
options: { | |
config: 'config.production.rb' | |
} | |
} | |
}, | |
}, | |
handlebars: { | |
compile: { | |
files: { | |
"public/js/templates/templates.js": "public/js/templates/*.hbs" | |
}, | |
options: { | |
namespace: 'Handlebars.templates', | |
processName: function(filePath) { | |
var pieces = filePath.split("/"); | |
return pieces[pieces.length - 1].replace('.hbs', ''); | |
} | |
} | |
} | |
}, | |
qunit: { | |
files: ['test/unit/**/*.html'] | |
}, | |
qunit_junit: { | |
options: { | |
// Task-specific options go here. | |
dest: '_build/test-reports', | |
namer: function (url) { | |
var match = url.match(/test\/unit\/(.*)$/); | |
return match[1].replace(/\//g, '.').replace('.index.html', ''); | |
} | |
} | |
}, | |
jshint: { | |
files: [ | |
'gruntfile.js', | |
'public/js/core/*.js' | |
], | |
options: { | |
// options here to override JSHint defaults | |
globals: { | |
jQuery: true, | |
console: true, | |
module: true, | |
document: true | |
} | |
} | |
}, | |
watch: { | |
handlebars: { | |
files: ["public/js/templates/*.hbs"], | |
tasks: ['handlebars'] | |
}, | |
compass: { | |
files: ['<%= compass.files %>'], | |
tasks: ['compass:dev'], | |
options: { | |
livereload: true, | |
}, | |
}, | |
test: { | |
files: ['<%= jshint.files %>'], | |
tasks: ['jshint'] | |
} | |
}, | |
uglify: { | |
options: { | |
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy HH:MM") %> */\n' | |
}, | |
dist: { | |
files: { | |
'public/js/<%= pkg.name %>.min.js': [ | |
'public/js/library/jquery.js', | |
'public/js/library/handlebars.runtime.js', | |
'public/js/library/bootstrap.js', | |
'public/js/core/application.js', | |
'public/js/templates/templates.js' | |
] | |
} | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-compass'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-qunit'); | |
grunt.loadNpmTasks('grunt-contrib-handlebars') | |
grunt.loadNpmTasks('grunt-qunit-junit'); | |
grunt.registerTask('test', ['jshint', 'qunit_junit', 'qunit']); | |
grunt.registerTask('default', ['compass:dev', 'jshint', 'qunit', 'handlebars']); | |
grunt.registerTask('compass-dev', ['compass:clean', 'compass:dev']); | |
grunt.registerTask('compass-prod', ['compass:clean', 'compass:prod']); | |
grunt.registerTask('production', ['compass:clean', 'compass:prod', 'handlebars', 'uglify']); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my project name", | |
"description": "My project description", | |
"version": "0.0.1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment