Skip to content

Instantly share code, notes, and snippets.

@maestr0 maestr0/gist:6752298
Created Sep 29, 2013

Embed
What would you like to do?
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
You can’t perform that action at this time.