我正在尝试将grunt配置为livereload js和less/css文件的更改.虽然grunt正确地"监视"并执行分配的任务,但它不会对文件进行实时重载.下面是我的配置,有没有人看到有什么问题?
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
jshint: {
files: ["Gruntfile.js", "src/javascripts/**/*.js"],
options: {
globals: {
jQuery: true,
console: true,
module: true
}
}
},
concat: {
options: {
stripBanners: true,
banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> */\n",
separator: "\n"
},
js: {
src: ["src/javascripts/main.js", "src/javascripts/**/*.js"],
dest: "../app/assets/javascripts/application.js"
},
less: {
src: ["src/stylesheets/**/*.less"],
dest: "../app/assets/stylesheets/application.less"
}
},
watch: {
js: {
files: ["<%= jshint.files %>"],
tasks: ["jshint", "concat:js"],
options: {
livereload: …Run Code Online (Sandbox Code Playgroud) 是否有类似Rack-LiveReload的东西可以和Guard-LiveReload这样的工具一起用于Clojure开发?因为我已经使用它,所以我真的无法做到没有实时重装.如果没有比这更方便的话,我可以下载LiveReload JS文件并手动将其包含在我的应用程序中并将其与Guard-LiveReload一起使用,但如果有一个完整的Clojure解决方案,我会更喜欢它.我无法在我的机器上安装LiveReload应用程序,因为我使用的是Linux,这就是为什么我需要像Guard-LiveReload这样的东西.
我是Clojure的新手,但到目前为止,我将使用Ring和Compojure,这可能会有所作为.
我正在尝试使用grunt connect和livereload来配置基本URL.一切都正常,但我的网址是这样的:
http://0.0.0.0:8000/index.html
我希望他们这样:
http://0.0.0.0:8000/**newbase**/index.html
我的咕噜声连接:
module.exports = {
server: {
options: {
hostname: '*',
port: 8000,
base: './_site'
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的咕噜咕噜表:
module.exports = {
options: {
livereload: true,
},
build: {
files : [ '*.md', '_layouts/*.html', '_posts/*.markdown', 'css/*.css', 'css/libs/*.css', '_config.yml', 'index.html', '404.html' ],
tasks: ['shell:jekyllBuild'],
options: {
spawn: false,
}
}
}
Run Code Online (Sandbox Code Playgroud)
你可以看到我正在使用Jekyll.再次,connect,livereload和Jekyll构建都运行良好.只想使用不同的baseurl(像Jekyll配置允许,用例是在Github中构建项目站点).
谢谢!
根据离子指南第4章http://ionicframework.com/docs/guide/testing.html,离子服务将启动一个实时重装服务器,它在我的情况下,但重新加载没有发生.
我们需要有什么预先要求让这个东西工作吗?比如说重新加载Chrome扩展?
E:\Ionic\myapp>ionic serve
Running dev server: http://localhost:8100
Running live reload server: http://localhost:35729
Run Code Online (Sandbox Code Playgroud) 如何暂时禁用browsersync,以便它不会注入/修改HTML页面?(用于测试和调试.)
我试图用现场重装功能,以ionic serve和ionic emulate ios --livereload.服务器启动良好,应用程序显示在模拟器(或浏览器)中,它运行顺利.
当我更改文件(www目录中的js或html )并保存它时,HTML changed: www/index.html例如控制台写入,但应用程序不会按原样重新加载.
我认为服务器和应用程序之间的websocket可能会被破坏,但是当我杀死服务器(Ctrl-C)时,Web检查员立即触发了以下错误:
[Error] WebSocket network error: The operation couldn’t be completed. Connection refused (192.168.5.2, line 0, x4)
所以我认为websocket没有问题.此外,它在Web检查器的网络窗格中显示没有错误.
有什么我错过了livereload工作?
我的配置:
如果不清楚,请不要犹豫要求我澄清.
编辑
我也在没有互联网连接的情况下对它进行了测试,以检查它是否是防火墙问题或类似的问题,但它没有任何改变.
我是Sails和grunt的新手所以我可能会错过这个明显的东西.我试图在文件发生变化时自动在浏览器中刷新我的风帆应用程序.
我启动应用程序,sails lift它在默认端口上运行1337.
我尝试添加options: {livereload:true}到我的grunt-contrib-watch配置,但据我所知,我需要以某种方式将livereload JavaScript注入我的页面?
我尝试使用注入JavaScript grunt-contrib-connect的livereload选项,但似乎只是启动另一台服务器.当我导航到启动的服务器(localhost:8000)时,我只看到文件夹结构.然而,注入了livereload JavaScript.
如果可能的话,我想避免使用livereload Chrome插件.
将livereload JavaScript注入我的Sails应用程序的最佳方法是什么?或者我应该使用像Browsersync这样的其他工具?
谢谢!:)
livereload grunt-contrib-watch sails.js grunt-contrib-connect browser-sync
我使用Yeoman使用bower和grunt构建一个角度应用程序.运行grunt服务给了我这个错误:
Running "connect:livereload" (connect) task
Fatal error: Port 9000 is already in use by another process.
Run Code Online (Sandbox Code Playgroud)
我有另一个使用端口9000的进程,所以我想改变Grunt的端口.我试图改变我的Gruntfile中的端口,但我继续得到同样的错误.以下是Gruntfile.js中的grunt服务器设置
connect: {
options: {
port: 9002,
hostname: 'localhost',
livereload: 35729
},
Run Code Online (Sandbox Code Playgroud) 我正在使用intelliJ上的livereload测试spring-boot-devtools.我有简单的SpringBootApplication工作正常.
当我从maven命令"mvn spring-boot:run"启动应用程序时,一切正常,除了livereload服务器不启动.控制台上没有消息,Chrome扩展显示错误,无法连接到livereload服务器.
如果我启动应用程序(右摩丝按钮/运行Application.java),所有工作正常甚至livereload服务器.消息显示在控制台上,浏览器可以连接到livereload服务器.
从正确的慕斯按钮启动应用程序/运行Application.java
控制台消息
2016-07-13 16:39:47.947 INFO 10440 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-07-13 16:39:48.026 INFO 10440 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2016-07-13 16:39:48.077 INFO 10440 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-07-13 16:39:48.145 INFO 10440 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8090 (http)
Run Code Online (Sandbox Code Playgroud)
从mvn命令启动应用程序"mvn spring-boot:run"
Chorme扩展消息:
Could not connect to LiveReload …Run Code Online (Sandbox Code Playgroud) 我使用live-server与实时重新加载文件夹HTML,javascript并CSS使用Visual Studio Code。
当我在Google Chrome浏览器中打开控制台时,会看到此信息
“无法加载资源:服务器以404(未找到)状态响应 http://eluxer.net/code?sesscheck=1&id=105&subid=51824_5848_ “
我尝试使用许多不同的文件夹进行此操作,并且每次使用实时服务器时都出现相同的消息。同时,当我HTML直接在浏览器中打开文件时(没有实时服务器),没有错误消息。
拜托,谁能告诉我该如何解决?
google-chrome livereload visual-studio-code npm-live-server nodejs-liveserver
livereload ×10
gruntjs ×3
browser-sync ×2
javascript ×2
clojure ×1
connect ×1
ionic ×1
maven ×1
sails.js ×1
spring ×1
spring-boot ×1
watch ×1