Skip to content

Instantly share code, notes, and snippets.

@maestr0
Created September 29, 2013 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maestr0/6752298 to your computer and use it in GitHub Desktop.
Save maestr0/6752298 to your computer and use it in GitHub Desktop.
test
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
manifest: grunt.file.readJSON('manifest.json'),
concat: {
options: {
separator: ';'
},
popup: {
src: ['jquery-1.8.3.min.js', 'jquery-ui-1.8.16.custom.min.js', 'jquery.iphone-switch.js', 'popup.js'],
dest: 'package/js/popup.js'
},
background: {
src: ['jquery-1.8.3.min.js', 'background.js'],
dest: 'package/js/background.js'
},
contentscript: {
src: ['jquery-1.8.3.min.js', 'contentscript.js'],
dest: 'package/js/contentscript.js'
}
},
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
replace: {
dist: {
options: {
variables: {
'version': '<%=pkg.version%>'
},
prefix: '@@'
},
files: [
{expand: true, flatten: true, src: ['manifest.json'], dest: 'package/'}
]
}
},
uglify: {
options: {
banner: '/*!\n<%= manifest.name %> v<%=pkg.version %>\nAuthor: <%= pkg.author%>\nBuild: <%= grunt.template.today("dd-mm-yyyy hh:MM:ss") %> */\n'
},
dist: {
files: {
'package/js/contentscript.min.js': ['package/js/contentscript.js'],
'package/js/popup.min.js': ['package/js/popup.js'],
'package/js/background.min.js': ['package/js/background.js']
}
}
},
jshint: {
files: ['contentscript.js', 'background.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
copy: {
main: {
files: [
{expand: true, src: ['css/**','background.html', 'popup.html'], dest: 'package/'},
{expand: true, src: ['icon*.jpg','iphone*.png','ajax-loader.gif','icon_facebook.gif'], dest: 'package/images'}
]
}
},
watch: {
files: ['<%= jshint.files %>', 'scss/es.scss', '*.html'],
tasks: ['jshint', 'concat', 'uglify', 'compass']
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-replace');
grunt.registerTask('test', ['jshint']);
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'compass']);
grunt.registerTask('package', ['jshint', 'concat', 'uglify', 'compass', 'replace', 'copy']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment