gpt4 book ai didi

wordpress - Grunt watch livereload over MAMP Pro 虚拟主机和 ssl 返回错误 net::ERR_CONNECTION_CLOSED

转载 作者:太空宇宙 更新时间:2023-11-03 13:34:33 26 4
gpt4 key购买 nike

Grunt 文件:

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'build/css/build.css' : 'sass/main.scss',
},
},
},
concat: {
options: {
separator: ';',
},
dist: {
src: ['js/jquery-getquerystring.min.js','node_modules/featherlight/release/featherlight.min.js', 'js/main.js'],
dest: 'build/js/build.js',
},
},
concat_css: {
all: {
src: ['node_modules/featherlight/release/featherlight.min.css', 'build/css/build.css'],
dest: 'build/css/build.css',
}
},
watch: {
sass: {
files: ['sass/**/*.scss'],
tasks: ['sass', 'concat_css'],
options: {
livereload : 35729,
}
},
js: {
files: ['js/**/*.js'],
tasks: ['concat'],
options: {
livereload : 35729,
}
},
php: {
files: ['**/*.php'],
options: {
livereload : 35729,
}
},
options: {
style: 'expanded',
compass: true,
livereload : {
port: '37925',
host: 'mysite.dev',
key: grunt.file.read('/absolute/path/to/mysite.key'),
cert: grunt.file.read('/absolute/path/to/mysite.crt'),
},
},
},
});


grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-concat-css');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['sass', 'concat', 'concat_css', 'watch']);


};

就在我的结束 body 标签之前,我有:

<script src="https://mysite.dev:35729/livereload.js"></script>

转到 https://mysite.dev 没有任何问题,但是查看 Chrome 58 中的控制台选项卡我收到错误:GET https://mysite.dev:35729/livereload.js net::ERR_CONNECTION_CLOSED。但是,如果转到 url https://mysite.dev:35729/livereload.js,我会看到 livereload.js 的代码

如果有帮助,我会使用 MAMP Pro 4.1.1 来管理本地 Wordpress 开发。任何帮助表示赞赏。如果我需要提供任何其他信息,请告诉我。谢谢。

最佳答案

经过反复试验,我终于让它工作了:

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'build/css/build.css' : 'sass/main.scss',
},
},
},
concat: {
options: {
separator: ';',
},
dist: {
src: ['js/jquery-getquerystring.min.js','node_modules/featherlight/release/featherlight.min.js', 'js/main.js'],
dest: 'build/js/build.js',
},
},
concat_css: {
all: {
src: ['node_modules/featherlight/release/featherlight.min.css', 'build/css/build.css'],
dest: 'build/css/build.css',
}
},
watch: {
sass: {
files: ['sass/**/*.scss'],
tasks: ['sass', 'concat_css']
},
js: {
files: ['js/**/*.js'],
tasks: ['concat']
},
php: {
files: ['**/*.php']
},
options: {
style: 'expanded',
livereload : {
port: 1337,
host: 'mysite.dev',
key: grunt.file.read('/absolute/path/to/mysite.key'),
cert: grunt.file.read('/absolute/path/to/mysite.crt'),
},
},
},
});


grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-concat-css');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['sass', 'concat', 'concat_css', 'watch']);


};

就在结束正文标签之上:

<script src="//mysite.dev:1337/livereload.js"></script>

关于wordpress - Grunt watch livereload over MAMP Pro 虚拟主机和 ssl 返回错误 net::ERR_CONNECTION_CLOSED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44338154/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com