Created
February 24, 2015 18:15
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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