How to use a favicon with ember-cli? - ember.js

I had a favicon working for a while on my index template, but not any any other template, and now even my index template won't show it.
I'm just in development, so I'm using ember server.
index.html
<link rel="icon" href="favicon.ico">
Just throwing around my favicon to see if it shows up anywhere, I now have it in the following locations:
app/
public/
public/assets
I think this should be very straightforward, especially since the index page doesn't change, just get's new stuff loaded into its outlets, so I can't figure out why it can't find my favicon file.
When running ember server, where actually is the / root pointing to?

If you keep the favicon file in public/assets/ you can reference it like this:
<link rel="icon" href="/assets/favicon.ico">
The Ember CLI docs have a good section on this

You could also check out ember-cli-favicon.
It's an addon that takes your source public/favicon.png and automatically outputs all the different favicon formats and sizes for different devices, as well as injects the appropriate HTML into your index.html file as part of the build process.

Related

Find download URL from datatables "CSV" button?

This R Shiny application appears to use DT to display its tables. At least in the source code I see:
<script src="plotly-binding-4.10.0/plotly.js"></script>
<link href="datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet" />
<script src="datatables-binding-0.20/datatables.js"></script>
<link href="crosstalk-1.2.0/css/crosstalk.min.css" rel="stylesheet" />
<script src="crosstalk-1.2.0/js/crosstalk.min.js"></script>
It also has a "CSV" button to download the data:
How do I download the data from this website myself without clicking? I suppose the button runs some javascript, which makes a network call, but the "network" tab of the chrome debugger doesn't show any activity.
Ideally I could find a URL to the data, and then I could use the language of my choice (e.g., wget, curl, python, ..).
Looks like the raw data are coming from here via the project github. Seems like git pull could do it for you pretty easily.
https://github.com/Metropolitan-Council/covid-poops/blob/main/R/d_covid_cases.R
https://static.usafacts.org/public/data/covid-19/covid_confirmed_usafacts.csv?_ga=2.86006619.233414847.1642517751-2016304881.1642174657
And the other data are in this repo.
https://github.com/Metropolitan-Council/covid-poops/tree/main/data
I was able to use the python requests library to pull the raw data.
import requests
x = requests.get('https://static.usafacts.org/public/data/covid-19/covid_confirmed_usafacts.csv?_ga=2.86006619.233414847.1642517751-2016304881.1642174657')
print(x.text)
Edit: It looks like the shiny data are coming from here. I would just grab them via git. The github readme states, "The Shiny app is located in ./metc-wastewater-covid-monitor. /data contains relevant CSV data and /www contains CSS, HTML, and relevant font files the app needs upon running."
https://github.com/Metropolitan-Council/covid-poops/tree/main/metc-wastewater-covid-monitor/data
You can write a script to use a headerless browser to navigate to the page and download the file. Selenium is the usual first choice for this kind of work.

Ember: Application.hbs not generating in body while building

I have a problem with ember-cli build option.
While running server by ember s it's showing normal page with content, styles etc.
But now I want to build this app and put it on my website by ftp so i tried ember build which build my project into /disk folder but the index.html file doesn't contain the stuff from application.hbs + no styles from styles/app.css.
I'm new to ember. What am I doing wrong? Docs of ember are saying nothing about this.
All of your app is actually pulled in through external assets.
So, looking at your pre-built index.html, you'll see something like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>emberclear</title>
{{content-for "head"}}
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link rel="stylesheet" href="{{rootURL}}assets/emberclear.css">
{{content-for "head-footer"}}
</head>
<body class='has-navbar-fixed-top'>
{{content-for "body"}}
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/emberclear.js"></script>
{{content-for "body-footer"}}
</body>
</html>
my application is https://emberclear.io, named emberclear, so substitute your app name where applicable.
In the head, we see two link tags.
the first link is for all the styles that your addons may include (maybe such as material-ui, or bootstrap, or bulma).
The second link is your actual app styles. for me, emberclear.css includes everything from app.css, and all of its dependencies (I'm actually using scss, so I can include stuff via scss' #import).
Down in the body we see two script tags.
vendor.js will contain ember itself, and any addon dependencies that need to be included at run time, such as ember-paper's library of components.
emberclear.js includes your app -- routes, templates, etc.
This technique is common for all single page apps, and isn't exclusive to ember. anything built with react, or vue, has a similar pattern.
If you're wanting to have html and css be a part of your index.html, fastboot (https://www.ember-fastboot.com/) + prember (pre-rendered ember: https://github.com/ef4/prember ) may be of interest to you.
Hope this helps! :)
If something is wrong, feel free to copy your built index.html from dist (and maybe additional files as well).
Some follow up questions for you, depending on the issues you are running in to:
Are you getting any errors?
What happens when you try to open the dist/index.html file locally?
You're uploading the contents of dist to an ftp folder. This in-of-itself is fine, but has the web-sever been told to use that ftp folder for a website?
How are you attempting to access the ftp folder via browser?
Maybe there is a domain/path we could look at to see additional details?

Amazon AWS S3 Site Update

I've looked through just about every related question on here that I can find and none of the suggested solutions seem to resolve my problem.
I'm currently hosting a website on Amazon AWS using strictly the S3 and Route 53 tools to host a static website and re-route from a couple of different URL queries to our site. This morning I attempted to update the CSS files being used to style the webpage, as well as a bunch of new image files and some minor updates to the HTML pages, and noticed that all of my changes showed up immediately on the webpage except the changes I had made to my CSS file. I've checked, and the version of the file on the S3 is the correct/updated version, but when I attempt to use the Developer Tools in my web browser to inspect the webpage displayed, it's still showing an older version of the css file. This doesn't make any sense to me, as all of the other changes show up immediately except for this particular file. Does anyone have any thoughts on how to fix this/what could be going wrong?
NOTE: I'm not using AWS CloudFront on this webpage at all so I don't believe that any of the "invalidation" suggested elsewhere will help me. In the past, I've updated the files and seen immediate changes when loading my webpage.
You already know this is a browser cache issue - which you can clear the cache, but if you want to force everyone to automatically get the new CSS, what I usually do is add a query parameter to the file include, i.e. instead of
<link href="~/css/plugins/thickbox/thickbox.css" rel="stylesheet" />
do this:
<link href="~/css/plugins/thickbox/thickbox.css?v=1001" rel="stylesheet" />
and you can up the 1001 each time you push out an update - the browser will automatically grab the new file.
Google 'cache-busting' for other options.

project set up using github pages not loading

I hosted one of my project using GitHub pages but, for some reason, when I access the URL the page doesn't loads, and when I check it in the dev console it shows this error.
This is my GitHub page URL: https://prasunk96.github.io/colorsgame/
I checked that all the internal links that I have in my html file are all correct.
I have tried it several times but it showing the same problem again and again.
There are two issues with your CSS link:
It is not relative to your html file so the browser is trying to go directly from the base prasunk96.github.io/ and not include the /colorsgame/.
Github.io urls are case sensitive so your colorGamepro.css isn't being matched to the ColorGamepro.css file.
To correct the relative url you can either add a base tag to your HTML file or use a relative href. Once you correct the file name it should be able to find your file at https://prasunk96.github.io/colorsgame/css/ColorGamepro.css
In short use: href="./css/ColorGamepro.css"
Github project pages can sometime take a bit before being updated. See "My GitHub page won't update its content" for a similar issue.
I do see (a few hours later) a 404 for your css:
Try and see if using an anchored url works better:
<link rel="stylesheet" type="text/css" href="/css/colorGamepro.css">
^^^
|

In Ember, should I put my theme layout in application.hbs or index.html?

I started working on Ember js using ember-cli and I want to migrate an existing code written in html, jquery and css. I am not sure if its best to put it in the index.html or application.hbs ?
Probably your application.hbs file. As mentioned in the Ember CLI guide, the index.html file is mostly for addons to inject their scripts. You don't need to go that route though. You can manage your legacy Javascript and CSS using the Broccoli asset pipeline and you can put any legacy/common HTML in your application.hbs file.
It's best to put your code in application.hbs, except of tags which need to be put in <head> tag.
You can see that in index.html you have HTMLBars expression:
{{content-for 'body'}}
It's where your generated HTML application code is put, but first, it's wrapped in ember wrapper div, inside of which your application events are handled.
Imagine that you have put one of your divs in index.html - let's call it .main-div, then - in application.hbs - you've put code which has some Ember logic(so you can't put it in index.html too). Now, imagine you write CSS code to target one of children of .main-div. You target it like this in your CSS: .main-div > .dynamic-div, but it won't work. Why? Ember wrapped contents of application.hbs in its div and it's one level down. That's why it would be against developer intuition to put application HTML code in index.html - it could bite you if you forget that you have one layer more of Ember code even if in your editor you see it should be straight: .main-div > .dynamic-div.
Example of Ember.js wrapper div:
<div id="ember463" class="ember-view">