Skip to content

Instantly share code, notes, and snippets.

@vascogaspar
Last active September 18, 2015 13:19
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 vascogaspar/1bf65e95c924111da30a to your computer and use it in GitHub Desktop.
Save vascogaspar/1bf65e95c924111da30a to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', 'src/**/*.js'],
options: {
globals: {
jQuery: true
}
}
},
watch: {
scripts: {
files: ['src/js/<%= pkg.name %>.js', 'src/js/refactor.js'],
tasks: ['jshint', 'uglify'],
options: {
spawn: false,
},
},
css: {
files: ['src/scss/*.scss', 'src/scss/**/*.scss'],
tasks: ['sass']
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> by <%= pkg.author %> */\n/*! Last Updated: <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/js/<%= pkg.name %>.js',
dest: 'dist/js/<%= pkg.name %>.min.js'
}
},
sass: {
options: {
style: 'compressed',
precision: 5
},
dist: {
files: {
'dist/css/<%= pkg.name %>.css': 'src/scss/<%= pkg.name %>.scss'
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Compile SCSS Files to CSS
grunt.loadNpmTasks('grunt-contrib-sass');
// Check for JS code quality
grunt.loadNpmTasks('grunt-contrib-jshint');
// Whatch for file changes and run default tasks
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['uglify', 'sass', 'jshint']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment