angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

favicon not being deployed/displayed

Open peterennis opened this issue 10 years ago • 11 comments

Microsoft Windows Version 10.0.14393 2016 Microsoft Corporation. All rights reserved.

C:\Users\Peter Ennis>ng version angular-cli: 1.0.0-beta.14 node: 6.6.0 os: win32 x64

I have tried a number of options in the index.html file to get the favicon showing but without success.

The localhost site and direct github link show the favicon.

The site is a masked redirect from godaddy to github gh-pages using the ng github-pages:deploy

Some examples of favicon testing that fail, but have worked in the past with other deploy methods:

<head>
  <meta charset="utf-8">
  <title>Adaept</title>
  <base href="/adaept/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="https://adaept.github.io/adaept/favicon.ico">
  <!-- <link rel="icon" sizes="16x16 32x32" href="favicon.ico?v=2">
       <link rel="icon" type="image/x-icon" href="favicon.ico"> -->

When I look in the dist folder and parent there is no favicon.ico file available to be deployed.

Does the file have to be manually copied? I would expect deploy to take care of this.

capture68

peterennis avatar Sep 19 '16 21:09 peterennis

I had to put mine in the assets folder and change the path in the index.html

jbeckton avatar Sep 19 '16 23:09 jbeckton

I could not find any assets folder in the system. Starting with new ... Here: https://github.com/angular/angular-cli/issues/713 is another reference from @ustaDAH

peterennis avatar Sep 20 '16 01:09 peterennis

This also seems related: https://github.com/angular/angular-cli/issues/2202

peterennis avatar Sep 20 '16 01:09 peterennis

You have to create an assets folder in your src folder. By convention the CLI will copy it for you to /dist.

The webpack version of the CLI replaced the public folder for one named assets

jbeckton avatar Sep 20 '16 20:09 jbeckton

@jbeckton @peterennis yes that (creation of /src/assets) worked.

ustaDAH avatar Sep 21 '16 17:09 ustaDAH

How do we find out if the team still wants to have the favicon.ico file copied during build?
It appears this might have been lost in Pull Request 2056

If it should still do this, I think the following will fix it...

In packages\angular-cli\models\webpack-build-common.ts update the plugins object to include a copy of the favicon.ico file:

      new CopyWebpackPlugin([
        {
          context: path.resolve(appRoot, appConfig.assets),
          from: { glob: '**/*', dot: true },
          ignore: [ '.gitkeep' ],
          to: path.resolve(projectRoot, appConfig.outDir, appConfig.assets)
        }, {
>>        from: path.resolve(projectRoot, appConfig.root, 'favicon.ico'),
>>        to: path.resolve(projectRoot, appConfig.outDir)
        }
      ])

If someone wants to do a pull request to fix this, please go ahead. There is too much overhead for me to follow the developers guidelines just for this simple fix. I don't have the time right now. Thanks!

Paul

pauldubois777 avatar Sep 21 '16 18:09 pauldubois777

This works! Thanks

nmorado avatar Sep 21 '16 19:09 nmorado

Dupe of https://github.com/angular/angular-cli/issues/2137

filipesilva avatar Sep 22 '16 01:09 filipesilva

I'd be tempted to rather have favicon.ico in the assets folder and change the url in the index.html accordingly. (And of course also change ng new ... to generate seed sources as such).

ustaDAH avatar Sep 22 '16 13:09 ustaDAH

It Works! Thanks!

JScafidi616 avatar Feb 21 '18 18:02 JScafidi616

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.