Skip to content

Instantly share code, notes, and snippets.

@methodik
Created December 15, 2014 14:15
Show Gist options
  • Save methodik/f957ce73ca23d195fb73 to your computer and use it in GitHub Desktop.
Save methodik/f957ce73ca23d195fb73 to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
// All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: 8000,
hostname: '*'
}
}
},
less: {
development: {
options: {
paths: ["src/Hevnly/ApiBundle/Resources/public/css/main/*"]
},
files: {
"css/hevnly.css": "src/Hevnly/ApiBundle/Resources/public/css/main.less"
}
}
},
autoprefixer: {
options: {
},
your_target: {
src: 'css/hevnly.css',
dest: 'css/hevnly-prefixed.css'
}
},
watch: {
livereload: {
files: 'css/hevnly.css',
options: {
livereload: true
}
},
css: {
files: ['src/Hevnly/ApiBundle/Resources/public/css/main/*.less'],
tasks: ['shell:less']
},
watchmain: {
files: ['src/Hevnly/ApiBundle/Resources/public/css/main.less'],
tasks: ['less', 'autoprefixer', 'scp']
}
},
scp: {
options: {
host: '192.168.56.101',
username: 'vagrant',
password: 'vagrant'
},
your_target: {
files: [{
cwd: './',
src: 'css/*',
filter: 'isFile',
// path on the server
dest: '/var/www/hevnly.dev/web/'
}]
}
},
shell: {
less: {
command: 'touch src/Hevnly/ApiBundle/Resources/public/css/main.less'
},
install: {
command: [
'npm install grunt-contrib-less --save-dev',
'npm install grunt-contrib-watch --save-dev',
'npm install grunt-contrib-connect --save-dev',
'npm install grunt-scp --save-dev',
'npm install grunt-shell --save-dev',
'npm install grunt-autoprefixer --save-dev'
].join('&')
}
}
});
// Where we tell Grunt we plan to use this plug-in
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-scp');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-autoprefixer');
// Where we tell Grunt what to do when we type "$ grunt" into the terminal
grunt.registerTask('default', ['less', 'autoprefixer', 'scp', 'connect', 'watch']);
grunt.registerTask('install', 'shell:install');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment