Gulp download remote JSON files during build - gulp

I have a static site reliant on a remote JSON file which is under my control and doesn't change much.
I'm using gulp to build the static site and would like to add a gulp task to automatically get the remote JSON during the build, so I can include it as a local file.
I've not come across a plug-in to do this. Can anybody suggest one?

Found it! https://www.npmjs.com/package/gulp-download-files will allow you to download files locally.

Related

Testing local website with Protractor

I am developing simple website (html, css) and I want to write few tests against it in Protractor.
Is it possible to check that kind of website with Protractor? I have html file on my computer only. Should I run this website locally on server? I don't think I can run test on file directly.
Yes, its possible to open a stand-alone local html file without hosting it on a local server.You have to add this browser.resetUrl = "file:///"in your onPrepare() function and then a browser.get("file:///C:/Users/demo/test.html") would work
There are some good examples #this question - Opening a file with protractor
A common way to do it is to approach it in multiple steps:
build your application
run a local web server from the build directory (I think this is the part you are asking about)
run tests against your app served by the local web server
stop the local web server
Usually, this multi-step process is handled by a task runner like grunt or gulp. We use grunt, grunt-contrib-connect to serve from a directory, grunt-protractor-runner to run protractor from grunt.

How to deploy Libgdx game into the real web server

I built the Libgdx game with Gradle and success in deployment on localhost. So I move the code into the real server. However, when I open the browser of my game..it seems like the browser reads url (localhost). Nothing appear!! I am wondering if I have to set up more info for javascript to run the game on the real server or in config files somewhere ?
How you build web-server version of your project? You should use this command:
$ ./gradlew html:dist
Results files will be inside folder: html/build/dist
You should copy all files to webroot folder of your vhost.
Structure should be something like this:
assets
html
index.html
soundmanager2-jsmin.js
soundmanager2-nodebug-jsmin.js * - i also download from soundmanager website nodebug version of soundmanager
soundmanager2-setup.js
styles.css
I was programming gwt project few times. For example: http://ciufcia.pl/boomki-nimm2.
If this does not help, please give some logs from webconsole.

gulp-useref don't build my remote hosted files into min.js

Hi I try to build all css and js into /dist/ but I only have the local file... why useref don't download ands put my jquery cdn from google into ma min.js
please there is solution for this (I don't really want to use an package manager as bower) I prefer gulp-useref do this work... idea?
It only works on relative url's, not absolute url's. It does not have the ability to download remote files and compile them, and that's always risky anyway. You should import these assets from a package manager and compile them that way. That's the only way that gulp-useref currently supports.

How to perform grunt remote debug in IntelliJ IDEA?

I build and run my typescript application by Grunt and connect(grunt-contrib-connect) and livereload plugins. While grunt compile .ts files, it also generate sourcemap. My application is oppening on google chrome. How can I remotely connect by Intellij Idea to this application that was run by Grunt and oppened in Chrome for perform debug?
This post is my last hope, that it is possible. Thanks
create a new javascript debug run configuration
in URL field, specify the URL of your client app (http://localhost:9001/index.html or whatever it looks like)
if your local project structure doesn't exactly match the app structure on server (for example, static files are served from <project_root>/public folder), specify remote URL mappings (see http://confluence.jetbrains.com/display/WI/Starting+a+JavaScript+debug+session#StartingaJavaScriptdebugsession-Startingadebugsessionwhenusingadifferentwebserver)
that should be enough... Start grunt, and, when the server is up and running, debug the configuration above
Thank you. I found solution.
First of all, I need Jet Brains extension for Chrome.
I need to make configure debug mode "JavaScript debug" and specify URL that grunt will run and open application.
Run Grunt task that build and open application in browser.
Run debug mode that just reload same page under debugger already.
Don't forget enjoy it.
Since I use typescript, ability to debug in IDE was very important.

How can I stop "jekyll build" from overwriting existing files in the output directory?

The source for my Jekyll-powered website lives in a git repo, but the website also needs to have a couple large static files that are too large to go under version control. Thus, they are not part of the Jekyll build pipeline.
I would like for these to simply live in an assets directory in the Jekyll destination (which is a server directory; note that I don't have have any control over the server here; all I can do is dump static files into a designated directory) that does not exist in the git repo. But, running jekyll build deletes everything in the output directory.
Is there a way to change Jekyll's behavior in this case? Or is there some other good way to handle this issue?
Not sure this addresses the specific case in the OP, but seeing as how I kept getting to this page when I finally found an answer here, I thought I'd add an answer to this question in case it helps others.
I have a git post-hook that builds my jekyll site in my webhost when I push to my host, but it was also deleting anything else that I had FTP'ed over. So now I've put anything I need to stick around in a directory (external/ in my case), and added the following to my _config.yml:
exclude: [external]
keep_files: [external]
and now files in external/ survive.
If you upload Jekyll's output directory via FTP to your server, you can use a FTP tool that lets you ignore folders.
For example, my own site is built with Jekyll, but hosted on my own webspace, so I'm uploading it via FTP.
I explained in this answer how I scripted the building and uploading process, so I can update my site with a single click.
In my case (Windows), I used WinSCP, a free command-line FTP client, for this.
If you're not on Windows, you need to use something else, but there are probably other FTP tools out there that are able to ignore folders.
To ignore your assets folder in WinSCP, you just need to put this line into the script file:
(the file which contains the actual WinSCP commands - read my other answer for more information)
option exclude "assets/"
Now you can upload your large assets folder on the server once, and it won't be overwritten/deleted when you later update your site via FTP.