Javascript 咕哝着livereload,用php观看,没有yeoman
我不能再尝试了,很多个小时,但什么都没有。 问题来自LiveReload,我不会将更改重新加载到浏览器。我可以说,如果它能在编译的js和css中工作,而不是livereload 我把gruntfile.js放在这里,看看你是否能看到错误Javascript 咕哝着livereload,用php观看,没有yeoman,javascript,gruntjs,grunt-contrib-watch,Javascript,Gruntjs,Grunt Contrib Watch,我不能再尝试了,很多个小时,但什么都没有。 问题来自LiveReload,我不会将更改重新加载到浏览器。我可以说,如果它能在编译的js和css中工作,而不是livereload 我把gruntfile.js放在这里,看看你是否能看到错误 grunt test --verbose 我做了很多测试,终端显示了以下内容,但实际上没有在浏览器中重新加载 Running "recess:dist" (recess) task Verifying property recess.dist exists i
grunt test --verbose
我做了很多测试,终端显示了以下内容,但实际上没有在浏览器中重新加载
Running "recess:dist" (recess) task
Verifying property recess.dist exists in config...OK
Files: ./css/landing.less -> ./css/landing.css
Options: banner="", compress, footer="", report=null, compile
Writing ./css/landing.css...OK
File "./css/landing.css" created.
Original: 4553 bytes.
Minified: 3687 bytes.
Done, without errors.
Live reloading css/landing.less...
Completed in 4.493s at Fri Jan 03 2014 15:51:37 GMT+0100 (CET) - Waiting...
php: estructura.php has changed
OK
>> File "template.php" changed.
Live reloading template.php...
Completed in 0.001s at Fri Jan 03 2014 15:51:54 GMT+0100 (CET) - Waiting...
grunfile.js
'use strict';
var path = require('path');
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
var gateway = require('gateway');
var phpGateway = function (dir){
return gateway(require('path').resolve(dir), {
'.php': 'php-cgi'
});
};
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
miapp: {
app: '.'
},
concat: {
all: {
src: "./js/*.js",
dest: "./js/todos.js"
},
},
uglify: {
options:{
banner: '/* <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
my_target: {
files: {
'js/landing.min.js': ['js/landing.js']
},
},
},
recess: {
dist: {
options: {
compile: true,
compress:true
},
files: {
'./css/landing.css': ['./css/landing.less']
},
},
},jshint:{
all:['./js/landing.js']
},jsonlint: {
sample: {
src: [ 'some/valid.json' ]
},
},imagemin: { // Task
static: { // Target
options: { // Target options
optimizationLevel: 3
}
},
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: './', // Src matches are relative to this path
src: ['**/images/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'test/' // Destination path prefix
}]
},
},watch: {
options: {
livereload: true
},
css:{
files: ['css/landing.less'],
tasks: ['recess'],
},
js:{
files: ['js/landing.js'],
tasks: ['build']
},
php:{
files: ['./**/*.php']
},
// images:{
// options: { livereload: true },
// files: [ 'images/**/*.{png,jpg,jpeg,gif,webp,svg}']
// }
},php: {
dev:{
options: {
port: 8000,
// keepalive: true,
open: true,
base: '<%= miapp.app %>',
hostname: 'localhost'
}
},
watch: {
options: {
livereload: 45678
},
}
},mocha: {
all: {
options: {
run: true,
urls: ['http://<%= php.dev.options.hostname %>:<%= php.dev.options.port %>/*.php']
}
}
},
bower: {
dev: {
dest: './components'
},
},
'bower-install': {
app: {
src: ['template.php']
},
},
});
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
// registramos las tareas (plugins) desde npm en Grunt
//grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-bower-install');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-php');
grunt.loadNpmTasks('grunt-mocha');
//grunt.loadTasks('watch');
//grunt.registerTask('watch', ['watch']);
// registramos las tareas que se pueden ejecutar y el orden
grunt.registerTask("test", ["php","watch"]);
grunt.registerTask("default", ["uglify","connect","recess","watch" ]);
grunt.registerTask("build", ["concat", "uglify", "recess"]);
grunt.registerTask("load", ["connect"]);
grunt.registerTask("js", ["jshint"]);
grunt.registerTask("plantilla", ["bower-install"]);
grunt.registerTask("images", ["imagemin"]);
//grunt.registerTask('watch', ['watch']);
};
“严格使用”;
var path=require('path');
var mountFolder=函数(连接,目录){
返回connect.static(require('path').resolve(dir));
};
var gateway=require('gateway');
var phpGateway=函数(dir){
返回网关(require('path')。解析(dir){
“.php”:“php cgi”
});
};
module.exports=函数(grunt){
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
miapp:{
应用程序:'.'
},
康卡特:{
全部:{
src:“./js/*.js”,
目标:“./js/todos.js”
},
},
丑陋的:{
选项:{
横幅:'/**/\n'
},
我的目标:{
档案:{
'js/landing.min.js':['js/landing.js']
},
},
},
休会:{
地区:{
选项:{
编译:对,
压缩:真
},
档案:{
'./css/landing.css':['./css/landing.less']
},
},
},jshint:{
全部:['./js/landing.js']
},jsonlint:{
样本:{
src:['some/valid.json']
},
},imagemin:{//Task
静态:{//目标
选项:{//目标选项
优化级别:3
}
},
动态:{//另一个目标
档案:[{
expand:true,//启用动态扩展
cwd:“./”,//Src匹配与此路径相关
src:['**/images/*.{png,jpg,gif}'],//要匹配的实际模式
dest:'test///目标路径前缀
}]
},
},观看:{
选项:{
利弗雷罗德:没错
},
css:{
文件:['css/landing.less'],
任务:[“休会”],
},
js:{
文件:['js/landing.js'],
任务:[“构建”]
},
php:{
文件:['./***.php']
},
//图像:{
//选项:{livereload:true},
//文件:['images/***.{png,jpg,jpeg,gif,webp,svg}']
// }
},php:{
开发人员:{
选项:{
港口:8000,
//基帕利夫:是的,
开放:是的,
基:“”,
主机名:“localhost”
}
},
观察:{
选项:{
利弗雷罗德:45678
},
}
},摩卡:{
全部:{
选项:{
run:是的,
URL:['http://://*.php']
}
}
},
鲍尔:{
开发人员:{
目标:'./组件'
},
},
“bower安装”:{
应用程序:{
src:['template.php']
},
},
});
grunt.event.on('watch',函数(操作、文件路径、目标){
grunt.log.writeln(目标+':“+filepath+”具有“+action”);
});
//注册软件(插件)下载npm文件
//grunt.loadTasks(“任务”);
grunt.loadNpmTasks(“grunt-contrib-concat”);
grunt.loadNpmTasks(“grunt-contrib-uglify”);
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks(“grunt-session”);
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-bower-install');
grunt.loadNpmTasks(“grunt-contrib-watch”);
loadNpmTasks('grunt-php');
grunt.loadNpmTasks(“grunt-mocha”);
//grunt.loadTasks('watch');
//grunt.registerTask('watch',['watch']);
//在埃杰克塔和厄尔奥尔登登记
registerTask(“test”,“php”,“watch”);
registerTask(“默认”、“丑陋”、“连接”、“休会”、“监视”);
注册任务(“build”,“concat”,“uglify”,“session”);
registerTask(“加载”,“连接”);
registerTask(“js”,“jshint”);
grunt.registerTask(“plantilla”,[“bower安装]);
registerTask(“images”,[“imagemin]”);
//grunt.registerTask('watch',['watch']);
};
我希望您能帮助我。如果您正在使用MAMP…您可能需要查看php5.5.3中的此默认缓存配置,并将其删除: 此外,您可能还需要检查livereload扩展(用于firefox)是否已正确安装和启用