Skip to content

Instantly share code, notes, and snippets.

@mikemurray
Created July 26, 2013 22:02
Show Gist options
  • Save mikemurray/6092566 to your computer and use it in GitHub Desktop.
Save mikemurray/6092566 to your computer and use it in GitHub Desktop.
Gruntfile for PHP and LESS with livereloading
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
php: {
dev: {
options: {
hostname: '127.0.0.1',
port: 5000
}
}
},
less: {
dev: {
files: {
"style.css": "style.less"
}
}
},
watch: {
markup: {
files: ['index.php'],
options: {
livereload: true,
}
},
styles: {
files: ['style.less'],
tasks: ['less:dev'],
options: {
livereload: true
}
},
}
});
// Tasks.
grunt.loadNpmTasks('grunt-php');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default', ['php:dev', 'watch']);
};
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php echo "Hello"; ?>
<script src="http://localhost:35729/livereload.js"></script>
</body>
</html>
{
"name": "test",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-less": "~0.6.4",
"grunt-contrib-watch": "~0.5.1",
"grunt-php": "~0.2.0"
}
}
@color: red;
body {
color: @color;
}
@IgnacioEscobar
Copy link

I keep getting this error: "Fatal error: spawn ENOENT", do you have any idea what im doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment