Created
July 26, 2013 22:02
-
-
Save mikemurray/6092566 to your computer and use it in GitHub Desktop.
Gruntfile for PHP and LESS with livereloading
This file contains 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
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']); | |
}; |
This file contains 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
<!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> |
This file contains 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
{ | |
"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" | |
} | |
} |
This file contains 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
@color: red; | |
body { | |
color: @color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I keep getting this error: "Fatal error: spawn ENOENT", do you have any idea what im doing wrong?