Skip to content

Instantly share code, notes, and snippets.

@RubenVW-dev
Created February 24, 2015 18:15
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 RubenVW-dev/783c862f9564d2453ffa to your computer and use it in GitHub Desktop.
Save RubenVW-dev/783c862f9564d2453ffa to your computer and use it in GitHub Desktop.
Grunt file to watch less/js files and ftpush css/js files
var jsVendors = [
'bower_components/jquery/jquery.min.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/modernizr/modernizr.js',
];
var jsApp = [
'assets/js/classes/*.js',
'assets/js/*.js'
];
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
write: {
files: [
'resources/assets/less/**/*.less',
'resources/assets/js/**/*.js',
'bower_components/**'
],
tasks: [
'less',
'uglify',
'copy'
]
},
ftpush: {
files: [
'css/*.css',
'js/**/*.js'
],
tasks: [
'ftpush'
]
}
},
ftpush: {
build: {
auth: {
host:'hostname',
port: 22,
authKey:'keyname'
},
src: '',
dest: '/path/to/destination/folder',
exclusions: [],
keep: [],
simple: true
}
},
less: {
main:{
files: {
'css/style.css': 'assets/less/theme-default.less' //-> change this to your app theme
},
options:{
cleancss: true
}
}
},
uglify:{
main:{
options:{
wrap: true,
banner: '/* <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n\n(function() {\n\nvar <%= pkg.name %> = {}; \n\n',
footer: '\n\n})();'
},
files:{
'js/app.js': jsApp
}
}
},
copy:{
main:{
files: [
{
expand: true,
flatten: true,
src: jsVendors,
dest: 'js/vendor'
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-ftpush');
grunt.registerTask('default', ['less', 'uglify', 'copy']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment