Skip to content

Commit

Permalink
exclude browserconfig.xml and *.webmanifest from asset files
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Apr 7, 2020
1 parent 11aa283 commit 30f55ef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/AssetFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public static function get($path)
->exclude('storage')
->notName('.htaccess')
->notName('web.config')
->notName('browserconfig.xml')
->notName('*.webmanifest')
->notName('*.json')
->notName('*.php')
->ignoreVcs(true)
Expand Down

12 comments on commit 30f55ef

@simonmaass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason the exclude the manifest from the asset files?

@fragkp
Copy link

@fragkp fragkp commented on 30f55ef May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@themsaid I've the same question. How could/should I implement the webmanifest file?

@simonmaass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@themsaid is info here?

@martijngastkemper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@themsaid I'm sorry, but I'm joining the line of people asking for an explanation. webmanifest files are necessary for PWA's, so I think filtering those files is not right. But if there is a good explanation I'm fine with that. The only problem is how can an app running on Vapor publish these files? Creating a route and returning the content is an option off course, but that bypasses CDN, caching and asset versioning. Or do you know other ways?

@simonmaass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simonmaass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunomaduro
Copy link
Member

@nunomaduro nunomaduro commented on 30f55ef Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this time would be a breaking change making changes on that list - because some customers have now created Laravel Routes that serve those files. In the future, we plan to provide a clean and built-in solution for this kind of files/situations.

For now, the option is to create a route that serves the files you need:

Route::get('/your-file-name.extension', function () {
    $contents = 'content' ; // Get the file content from the public path or from S3.

    return $contents;
});

We are going to keep your proposal in mind for a future major version.

@simonmaass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunomaduro thank you for the update!

@SuperHomer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pass throw the same issue and my solution was to use aws cli to upload the file directly in deploy command in vapor.yml.

@austincarpenter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunomaduro Any update on this one?

@scottcharlesworth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone needs to override this in the meantime, and are deploying with a Github Action or similar, then adding the following after the "Require Vapor CLI" step in your workflow will comment out the lines:

      - name: Patch Vapor CLI
        run: |
          sed -i "/->notName('browserconfig\.xml')/s/^/\/\//" $(composer config home)/vendor/laravel/vapor-cli/src/AssetFiles.php
          sed -i "/->notName('.*\.webmanifest')/s/^/\/\//" $(composer config home)/vendor/laravel/vapor-cli/src/AssetFiles.php

@pfried
Copy link

@pfried pfried commented on 30f55ef May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not easy to find. I created a site.webmanifest manually and added it to the public folder like described in the Documentation:

During deployment, Vapor will automatically extract all of the assets in your Laravel project's public directory and upload them to S3. In addition, Vapor will create a AWS CloudFront (CDN) distribution to distribute these assets efficiently around the world.

I would at least ask for documentation if you do not plan to change it

Please sign in to comment.