hexojs / hexo-browsersync Goto Github PK
View Code? Open in Web Editor NEWBrowserSync plugin for Hexo.
License: MIT License
BrowserSync plugin for Hexo.
License: MIT License
This is what I get using latest versions of hexo
, hexo-server
and hexo-browsersync
.
D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\lib\browsersync.js:32
return ~res.getHeader('Content-Type').indexOf('text/html');
^
TypeError: Cannot read property 'indexOf' of undefined
at Object.when (D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\lib\browsersync.js:32:44)
at D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\node_modules\connect-injector\lib\connect-injector.js:47:21
at Function._.each._.forEach (D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\node_modules\connect-injector\node_modules\underscore\underscore.js:153:9)
at ServerResponse.mixin._interceptCheck (D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\node_modules\connect-injector\lib\connect-injector.js:46:13)
at ServerResponse.mixin.end (D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\node_modules\connect-injector\lib\connect-injector.js:103:19)
at ServerResponse.self.(anonymous function) (D:\Repos\celsomiranda.github.io\node_modules\hexo-browsersync\node_modules\connect-injector\node_modules\uberproto\lib\proto.js:61:21)
at ServerResponse.res.end (D:\Repos\celsomiranda.github.io\node_modules\hexo-server\node_modules\compression\index.js:97:20)
at SendStream.notModified (D:\Repos\celsomiranda.github.io\node_modules\hexo-server\node_modules\serve-static\node_modules\send\index.js:309:7)
at SendStream.send (D:\Repos\celsomiranda.github.io\node_modules\hexo-server\node_modules\serve-static\node_modules\send\index.js:516:17)
at onstat (D:\Repos\celsomiranda.github.io\node_modules\hexo-server\node_modules\serve-static\node_modules\send\index.js:600:10)
at FSReqWrap.oncomplete (fs.js:78:15)
I want to replace http static file server to https. so how to configure?
<script id="__bs_script__">//<![CDATA[
document.write("<script async src='http://HOST:3000/browser-sync/browser-sync-client.js?v=2.17.5'><\/script>".replace("HOST", location.hostname));
//]]></script>
replace script url scheme to https.
I love browsersync and use it to make my own theme, but despite nicely works with hexo-renderer-ejs, I dont have same features with hexo-renderer-jade plugin!
Here a repo with two branchs: jade(not works) and ejs(works)
Remember: I only started hexo blog and add/config plugins/themes.
After working with browsersync a bit more I realize it can take over the functionality of hexo-server while providing resource reloads without even refreshing sometimes.
This would be an enhancement and possibly a configuration change.
Resources:
Hello,
In my production environment poduced using hexo clean && hexo deploy
the script that exho-browsersync inject into the webpage is also injected in production.
I think this should not happen.
Hello
I use the hexo3.9 mist theme
I installed and started this way.
Npm install -g browser-sync
Npm install hexo-browsersync --save
Hexo server
But nothing happened
What should I do?
From @vedovato on July 2, 2015 17:17
After install browsersync on hexo project, how can i access it on my phone at the same network? Tried to put my ip/4000 without success.
Copied from original issue: hexojs/hexo#1366
Hi, I would like to configure my BrowserSync options like is possible in hexo-browser-sync for 2.8.3. There I can just do
browser_sync:
logLevel: "info"
ghostMode:
scroll: true
Is this possible for hexo-browsersync?
Thanks for your help, and work on this software.
hexo-browsersync
has to be in dependencies (devDependencies
does not work) in package.json
for hexo serve
to work
"dependencies": {
"hexo-browsersync": "^0.2.0",
//...
},
"devDependencies": {
"hexo-browsersync": "^0.2.0"
}
I needed to have it in package.json dependencies, otherwise I wouldn't get the following notification, nor the code injection in the footer.
[BS] Access URLs:
----------------------------------
UI: http://localhost:3001
----------------------------------
UI External: http://10.0.1.16:3001
----------------------------------
INFO Start processing
INFO Hexo is running at http://localhost:4000/blog/. Press Ctrl+C to stop.
I just install hexo and try to use hexo-browsersync. But I notice a bug: when generated page size bigger than some number (~1000 words) it can't be fully loaded, in chrome source code it looks like this:
If there is not so much characters in a page, everything is ok. So it happens only in big posts. When I uninstall hexo-browsersync bug is disappear, so it's definitely problem with hexo-browsersync.
I suppose it's could be some stream or buffer limit, but I'm new to node and can't solve this...
I've tried this:
if(self.route.isModified(path)){
queue.push(path);
}
in here
but isModified returns that all html files except css file were changed. If we could get this method to work properly, we would also get CSS inject feature working.
Any ideas?
I installed this plugin as dependency and.... what next?
With hexo server
nothing happens. 'Hexo is running at http://localhost:4000' as usual.
What should I do to initialize BrowserSync with hexo server
?
Could you please extend README.md?
I'm currenly using the Stun hexo template (hexo-theme-stun-master). This template uses pug files for coding all the templating elements. Each time a pug file or file being referenced by a pug file is changed, BrowserSync runs a refresh, but nothing really changes.
A hexo server full restart is required for the pages to render correctly.
I'm getting this message when I run hexo s
but adding that snippet is not necessary for browser sync to work.
Copy the following snippet into your website, just before the closing </body> tag
<script type='text/javascript' id="__bs_script__">//<![CDATA[
document.write("<script async src='http://HOST:3000/browser-sync/browser-sync-client.2.2.3.js'><\/script>".replace("HOST", location.hostname));
//]]></script>
We run hundreds of sites across various teams and are using Hexo (awesome system by the way) as our SSG combined with our own gulp-based build tools for some additional tasks.
One issue that we have is the ability to trigger browersync's reload command from within our gulp tasks because it cannot be uniquely identified (named,) therefore we can't use bs's native .get(instanceName)
command.
If we could update browsersync.js
lines 12 -13 to the below, then we could use an entry in the bs settings within hexo.config.json
to name the instance, or default it to being unnamed.
var bsConfig = self.config.browsersync || {};
var bsInstanceName = bsConfig.instanceName || '';
var bs = browsersync.create(bsInstanceName);
the math formulates can't be rendered if I use this plug.
(I use @upupming/hexo-renderer-markdown-it-plus to render the math formulates)
"browser-sync": "^2.0.1"
is quiet outdated and misses features such as https://browsersync.io/docs/options#option-scrollElements
Sync the scroll position of any element on the page. Add any amount of CSS selectors
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.