When I run 'hugo server --watch', I can visit the site by localhost:1313
But this is a http connection and is marked unsecured in chrome (or firefox), hence the equation is not rendered, they remain latex codes. When upload to server, e.g. github.io, it is rendered.
Is there a way to make mathjax render equation in server --watch mode? Thanks,
There is no way of making hugo server use https at present. I assume you are using a CDN to load MathJax - instead you could install it locally in your Hugo site's static folder (Hugo docs) and edit your Hugo theme to point to your local copy of the script.
Local installation has the advantages that you will be able to run MathJax locally over http, and that your your site will be more secure. (If you use a CDN without a hash attribute in the script tag, or with a browser that doesn't support hash attributes, then the CDN can change the JavaScript that runs on your site.) However, local installation has the disadvantage that people will have to download MathJax from your site instead of from the (probably much faster) CDN.
If you want to put the time and effort into it, then you could use a tool like Gulp or Grunt to set up a build process where you use a local version of MathJax on your local machine, and the CDN version on your production servers. But this will be overkill for most people.
Related
I write my first Gatsby Page. I also use Laravel as backend server.
In my project i have many slug pages. I used createPages and api connection to create them. User can add files like images, audio files and pdf. When it happen, page should change a bit content and show this file on specify address. Develop version works fine (i bind button to start npm run refresh). I used gatsby refresh endpoint and add to scripts:
"refresh": "curl -X POST http://localhost:8000/__refresh"
And it's work fine. But i don't know how change this to use it properly on production build. Can anyone help me? Thanks
The ENABLE_GATSBY_REFRESH_ENDPOINT environment variable is only working on development. According to the documentation:
During local development, it can be useful to refresh sourced content
without restarting the development server. To facilitate this, Gatsby
exposes an environment variable called ENABLE_GATSBY_REFRESH_ENDPOINT.
What you need is called a webhook. Basically, a webhook is a way for an application to trigger a change that happens in real-time in a CMS.
Each CMS has its own way of implementing webhooks, but the idea is to trigger a build process once a change in your CMS occurs.
Deployment of react-snap on a CRA app has been mostly painless, giving huge page load speed boosts and requiring zero specialized configuration.
However, I'm seeing occasional issues with deploys (both locally and from netlify) only crawling a single page and then appearing done. Like this:
Normal result (maybe 50% of the time) means crawling ~50 pages and then everything else successfully finishes.
I've tried limiting concurrency to 1 without improvement. What other tools can I use to figure this problem out or configuration options can I include to fix this?
Figured this out: Webpack was setting PUBLIC_URL to the production domain, and new deploys were looking on that domain for a JS file that looked like main.1234abcd.js, using a hash of the js file for cache busting. This didn't exist on the production domain before it was deployed so loading the page failed and no links were detected.
Setting the JS links to root-relative URL (i.e. /static/js/main.1234abcd.js) loaded the JS correctly from the snap-created server and allowed it to be crawled correctly.
In addition, it was helpful to debug via the anchor crawling section in react-snap here: https://github.com/stereobooster/react-snap/blob/master/src/puppeteer_utils.js#L108-L119
I'm trying to host my first website. I've made it using angularjs, bootstrap and yeoman as a generator. However when I tried to upload it, I realized that the full size of everything in my folder (including the generated stuff by yeoman) was nearly 100mb.
What files do I actually need to host? Node is nearly 60mb and grunt isn't much smaller. Any advice would be greatly appreciated.
Assuming you have a web server like nginx or apache already on that server, you just need to upload the dist folder that is created when you run grunt build.
You don't need all that generator and node stuff just to host a simple test project.
What you actually need is a single HTML file, called index.html. Include Angular and bootstrap (you can omit this, too, if you can go without fancy styles) and create a file app.js which will hold your application logic.
http://angularjs.org shows this in a neat way on their landing page, just scroll down to 'The basics'
As static angularjs application will contain mainly HTML, CSS and JS files you can host your project on simple apache webserver. (Apache - http://httpd.apache.org/)
If you are making a dynamic angularjs application you will have webservices returning you JSON data. If you implement the restful webservices in Java (using Jersey) you can deploy you entire angularjs application with java webserivce implementation to tomcat web server. (Tomcat - http://tomcat.apache.org/)
Hope this helps!
Decided to answer this old question because its one of the few that show on google when searched.
You do not need to use Grunt anymore, I do not know if this was needed at the time of this question.
instead just do
ng build my-app
this would have saved me some hours.
link to current doc
Not sure how to tell my point where, hopei make it as clear as possible.
I tried running some apps that are using Polymer and/or AngularDart, including:
https://www.dartlang.org/docs/tutorials/forms/#about-the-slambook-example
http://bwu-dart.github.io/users
the apps works very fine, one I run them using, "Pub serve" (Aka Ctrl+R from Dart editor), but once I run from the Dartium using the file "URL" things are not working well!!
I got an answer in Dartisans' google+ community the web server is a mus (https://plus.google.com/u/0/110229866977286723923/posts/UAH8ez51S53), is this means neither Polymer nor AngularDarrt are pure client side! by pure client side I mean can run from the file URL, without a web server.
I was thinking to make small app, for learning and testing, and packing it into 2 forms:
1. as Android APK using Android web view, but as server is required
2. as Chrome app
but having both need a web server, and the JavaScript conversion (build) is not acting similar to the output using the file URL, i.e. not completely as required, I got stuck!
Note: I'm using Windows 7, 64x, latest edition of Dart (Dev. 1.6.0), and latest edition of both AngularDart and PolymerDart.
any thought or idea pls
You need a server to serve static content because there are a lot of features with those libraries that are pulling your resources in dynamically. This isn't a Dart or Polymer issue, this is a browser security feature. By default, you can't make AJAX calls to your local machine. Pub serve is handling this for you, but you can chose any server you want to serve your local assets.
Contrary to some of what the other answers are saying, you don't need to build your Dart code when you're in Dartium. Dartium has the Dart VM built in for that very reason.
AFAIK you only need a server, but you need to generate some code, your development code can't directly go to your server, you need to do something like pub build, to make the code ready to be served directly.
You don't need a server, but you do need to build your code. pub serve does this automatically (and keeps on doing it as you change your code, so it's perfect for development), but to be able to use a file:// url, you need to run pub build first, and use the files generated in the build directory.
This is the same issue as discussed here https://stackoverflow.com/a/25248166/217408
and here I tried to reproduce and wasn't able.
After running pub build you can open the build output using a file URL just fine.
Polymer and Angular are definitely pure client side (if you want to use them this way).
That you can't run the Dart code without running pub build first is a bug in DI (used by Angular.dart and bwu_polymer_routing. DI currently requires some code generation that is done only when pub build or pub serve is run.
See also
- https://github.com/angular/angular.dart/issues/1344
- https://github.com/angular/angular.dart/issues/1276
You can try to use the workaround mentioned in issue 1276
Module.DEFAULT_REFLECTOR = new DynamicTypeFactories();
Is there any way to limit handlers to the development server only (in App Engine)?
My scenario:
In dev, I have my js and css split into many files, and it's easy to debug and watch the flow like this. I have a small script which compiles these resources into 2 files (1 js and 1 css) and creates a copy of index.html which includes only these 2.
There are different paths to the original vs. compiled HTML and resources, and I'd like the production version to only include the compiled ones. Any ideas?
In the app.yaml you could skip some files and prevent them from being uploaded, while they are still accessible when working locally.
Now if you want to check if your app is running locally or in the production server you should check the SERVER_SOFTWARE variable:
import os
PRODUCTION = os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Engine')
DEVELOPMENT = not PRODUCTION
Then depending on which templating language you are using you will have to pass one of the above or both of them, and based on them load either the minified versions or the actual sources.
You can examine the environment at runtime to determine what mode you're in. (Lipis posted the details.) And you can use that to dynamically construct array fed to WSGIApplication to maps requests to handlers. If you're in development mode, add development-mode-only entries to that array.