Skip to content

Instantly share code, notes, and snippets.

@santiblanko
Created June 29, 2014 07:14
Show Gist options
  • Save santiblanko/90d6b6cc1f9a60801b70 to your computer and use it in GitHub Desktop.
Save santiblanko/90d6b6cc1f9a60801b70 to your computer and use it in GitHub Desktop.
My gruntfile for laravel packages
module.exports = function(grunt) {
grunt.initConfig({
neuter: {
app: {
options: {
filepathTransform: function (filepath) {
return './src/assets' + '/' + filepath;
}
},
src: './src/assets/scripts/app.js',
dest: './src/assets/combined/combined-scripts.js'
}
},
emberTemplates: {
options: {
templateName: function (sourceFile) {
var templatePath = './src/assets/templates/';
return sourceFile.replace(templatePath, '');
}
},
main: {
files: {
'./src/assets/combined/compiled-templates.js': './src/assets/templates/**/*.hbs'
}
}
},
concat: {
options: {
separator: ';',
},
main: {
src: [
'./bower_components/jquery/dist/jquery.js',
'./bower_components/underscore/underscore.js',
'./bower_components/js-url/url.js',
'./bower_components/html2canvas/build/html2canvas.js',
'./bower_components/highcharts.com/js/highcharts.src.js',
'./bower_components/handlebars/handlebars.runtime.js',
'./bower_components/ember/ember.js',
'./bower_components/ember-data/ember-data.js',
'./bower_components/bootstrap/dist/js/bootstrap.js',
'./src/assets/dependencies/jquery.fastLiveFilter.js',
'./src/assets/dependencies/tooltip.js',
'./src/assets/combined/compiled-templates.js',
'./src/assets/combined/combined-scripts.js',
],
dest: './public/assets/scripts/tematic-app.js',
},
},
less: {
development: {
options: {
compress: true,
},
files: {
"./public/assets/styles/main.css":"./src/assets/styles/main.less"
}
}
},
uglify: {
options: {
mangle: false // names of functions and variables unchanged
},
main: {
files: {
'./public/assets/scripts/tematic-app.min.js': './public/assets/scripts/tematic-app.js',
}
}
},
phpunit: {
classes: {
dir:'tests'
},
options: {
colors:true
}
},
watch: {
neuter: {
files: ['./app/assets/scripts/{,*/}*.js'],
tasks: ['neuter']
},
emberTemplates: {
files: './app/assets/templates/**/*.hbs',
tasks: ['emberTemplates']
},
main: {
files: [
'./app/assets/scripts/*'
],
tasks: ['concat:main','uglify:main'],
options: {
livereload: true
}
},
less: {
files: ['./app/assets/stylesheets/*.less'],
tasks: ['less'],
options: {
livereload: true
}
},
tests: {
files: [
'src/controllers/*.php',
'src/models/*.php',
'src/repositories/*.php',
'src/services/*.php',
'tests/*',
],
tasks: ['phpunit']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-phpunit');
grunt.loadNpmTasks('grunt-ember-templates');
grunt.loadNpmTasks('grunt-neuter');
grunt.registerTask('default', ['watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment