digisfera / lr-http-server Goto Github PK
View Code? Open in Web Editor NEWAn HTTP server with livereload included
An HTTP server with livereload included
Hello @manuelcabral :)
It will be a good if you add the ability to add some url to opening exist url when open the page, for example:
lr-http-server -d min/ -u index.html/#/main
And the server will open my server with url:
min/index.html/#/main
The u
flag can set the url
Best regards!
It would be great if you could provide a comma-separated list of directories you want to serve files from.
I installed all dependencies and when i execute command "lr-http-server" console return white ... i don't know what i missing.. Finally return "node_modules\lr-http-server\node_modules\gaze\lib\gaze.js:331 return this._handleError(err);RangeError: Maximum call stack size exceeded"
This is because it's watching files using absolute paths. At this line
The fix for this would be to gaze at the relative paths instead.
gaze(watchFiles, function(err, watcher) {
if(err) {
console.error("Unable to watch files", err);
}
this.on('all', function(event, filepath) {
console.log(filepath + ' was ' + event);
livereloadServer.changed({body:{files:filepath}});
});
});
@manuelcabral I can PR this.
/usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/gaze.js:331
return this._handleError(err);
^
RangeError: Maximum call stack size exceeded
at Gaze._watchDir (/usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/gaze.js:331:17)
at /usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/gaze.js:387:10
at iterate (/usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/helper.js:69:5)
at /usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/helper.js:78:11
at /usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/gaze.js:452:5
at iterate (/usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/helper.js:69:5)
at /usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/helper.js:78:11
at /usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/gaze.js:452:5
at iterate (/usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/helper.js:69:5)
at /usr/local/lib/node_modules/lr-http-server/node_modules/gaze/lib/helper.js:78:11
Now getting this on latest version.
Hello, I'm trying to use your script, but here, when I run:
$lr-http-server -p 80 -w **.*.html,**.*.js
I got:
zsh: no matches found: **.*.html,**.*.js
I believe this server sends the incorrect path to the LiveReload client: the path sent is the local path while LiveReload needs the http path.
Why does it not inject <script>
to reload page on changes?
This is the HTML file, and it arrives to the browser un-modified:
<title><lume-gltf-model></title>
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background: white;
touch-action: none;
}
</style>
<lume-scene id="scene" perspective="800" webgl fog-mode="linear" fog-near="100" fog-far="500" fog-color="white">
<lume-ambient-light color="white" intensity="0.4"></lume-ambient-light>
<lume-camera-rig active initial-distance="200" max-distance="700" min-distance="100">
<lume-point-light position="200 0 200" intensity="0.7" color="white" slot="camera-child"></lume-point-light>
</lume-camera-rig>
<lume-node position="0 1000 0">
<!--
FIXME mesh with manual behaviors not working initially. Change the has
attribute to something else and back, then it works. Code load order
issue.
-->
<!-- <lume-mesh has="shape-geometry phong-material" size="0 0 5" color="white" position="30 0 0" sidedness="double" receive-shadow="false"> -->
<lume-shape
size="30 60 5"
color="red"
position="-120 0 0"
mount-point="0.5 1"
sidedness="double"
receive-shadow="false"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="30 60 10"
color="red"
position="-50 0 0"
mount-point="0.5 1"
sidedness="double"
receive-shadow="false"
fitment="contain"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="30 60 15"
color="red"
position="30 0 0"
mount-point="0.5 1"
sidedness="double"
receive-shadow="false"
fitment="cover"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="30 60 15"
color="red"
position="50 0 0"
mount-point="0.5 1"
sidedness="double"
receive-shadow="false"
fitment="scale-down"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="10 60 15"
color="red"
position="100 0 0"
mount-point="0.5 1"
sidedness="double"
receive-shadow="false"
fitment="scale-down"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="30 10 15"
color="red"
position="120 0 0"
mount-point="0.5 1"
sidedness="double"
receive-shadow="false"
fitment="scale-down"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
</lume-node>
<lume-node position="0 10 0" scale="-1 1 1">
<lume-shape
size="40 25 5"
color="red"
position="-120 0 0"
mount-point="0.5 0"
sidedness="double"
receive-shadow="false"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="40 25 10"
color="red"
position="-50 0 0"
mount-point="0.5 0"
sidedness="double"
receive-shadow="false"
fitment="contain"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="40 25 15"
color="red"
position="0 0 0"
mount-point="0.5 0"
sidedness="double"
receive-shadow="false"
fitment="cover"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="40 25 15"
color="red"
position="50 0 0"
mount-point="0.5 0"
sidedness="double"
receive-shadow="false"
fitment="scale-down"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="40 10 15"
color="red"
position="100 0 0"
mount-point="0.5 0"
sidedness="double"
receive-shadow="false"
fitment="scale-down"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
<lume-shape
size="10 25 15"
color="red"
position="120 0 0"
mount-point="0.5 0"
sidedness="double"
receive-shadow="false"
fitment="scale-down"
>
<lume-box
visible="false"
has="basic-material"
opacity="0.9"
size-mode="proportional proportional proportional"
size="1 1 1"
wireframe
></lume-box>
</lume-shape>
</lume-node>
<!-- prettier-ignore -->
<!-- <test>
<lume-mesh has="heart-2d-geometry phong-material" size="10 10 34" extrude shape-fit="contain"></lume-mesh>
<lume-heart-2d size="10 10 34" extrude></lume-heart-2d>
<lume-mesh has="path-shape-geometry phong-material" size="10 10 34" extrude shape-fit="contain" path="12.1 13, 5.3 16, 17 13"></lume-mesh>
<lume-path-shape size="10 10 34" extrude shape-fit="contain" path="12.1 13, 5.3 16, 17 13"></lume-path-shape>
</test> -->
</lume-scene>
<div class="ui">
<fieldset>
<legend>Options</legend>
<label> <input type="checkbox" onchange="updateSize()" /> Show size boundaries </label>
<br />
<label> <input type="checkbox" onchange="updateBevel()" /> Bevel </label>
</fieldset>
</div>
<script>
let showSize = false
const boxes = Array.from(document.querySelectorAll('lume-box'))
function updateSize() {
showSize = !showSize
for (const box of boxes) box.visible = showSize
}
let bevel = false
const hearts = Array.from(document.querySelectorAll('lume-shape'))
function updateBevel() {
bevel = !bevel
console.log(bevel)
for (const heart of hearts) {
heart.bevel = bevel
// if (bevel) heart.setAttribute('bevel', '')
// else heart.removeAttribute('bevel')
}
}
</script>
<style>
.ui {
position: absolute;
margin: 15px;
padding: 10px;
top: 0;
left: 0;
color: red;
font-family: sans-serif;
background: rgba(0, 0, 0, 0.1);
border-radius: 7px;
}
fieldset legend {
color: red;
}
fieldset {
border-color: red;
border-radius: 4px;
}
</style>
<script src="global.js"></script>
<script>
// Define all the LUME elements with their default names.
LUME.useDefaultNames()
</script>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.