dojo / cli-build-app

Command for building Dojo applications
Other
9 stars 32 forks source link

Solution needed for deploying favicon.ico #210

Closed MarvDann closed 5 years ago

MarvDann commented 5 years ago

Enhancement

At the moment when we build a dojo app we have to manually copy favicon.ico to the root of the website which isn't ideal in automated deployment scenarios and other methods need to be employed to copy the file.

A favicon.ico file needs to be present in the root of a website if you want to display a browser tab icon on all browsers. There are other methods which work in some browsers using meta tags to point to a file located elsewhere but this doesn't work consistently in Firefox and IE.

I think an improved solution would be to have the ability to define a shortcut_icon property in the .dojorc file which would copy the specified file into the root of the output build folder. Alternatively we could automatically look for favicon.ico in the root of /src and copy that during the build process if it is present.

Package Version: 4.0.2

Code

Expected behavior:

Actual behavior:

mwistrand commented 5 years ago

@MarvDann I'm actually updating the documentation now, but if you put a favicon.ico in the src/ directory, and then add <link rel="icon" href="favicon.ico"> to the src/index.html, it will be parsed from the HTML, hashed, and placed directly beneath output/{mode}. In fact, this also works with CSS and JS files embedded in src/index.html. Further, if you have a top-level assets directory that is a sibling to the src/ directory, its contents will be copied as-is (without hashing) to output/{mode}. These can also be referenced in src/index.html, but MUST use absolute paths. For example, <img src="/assets/some-random-img.png" alt="...">.

mwistrand commented 5 years ago

Before I forget, you can of course reference assets/ files in widgets as well: v('img', { src: '/assets/some-random-img.png', alt: '...' }).

mwistrand commented 5 years ago

README updates are now in master.

mwistrand commented 5 years ago

@MarvDann Closing this since it seems to have been resolved. Please feel free to reopen if that's not the case. Thanks!